只需將其設置爲請求屬性。
if (/* form is succesfully submitted */) {
request.setAttribute("success", true);
}
request.getRequestDispatcher("page.jsp").forward(request, response);
使用JSTLc:if
標籤基於EL表達式有條件地呈現內容。
<c:if test="${success}">
Your notification here.
</c:if>
如果你想生存的重定向,那麼你需要將其設置爲會議attribtue代替:
if (/* form is succesfully submitted */) {
request.getSession().setAttribute("success", true);
}
response.sendRedirect("page.jsp");
使用c:remove
第一顯示器後刪除它,以便後續請求將不會受到影響:
<c:if test="${success}">
<c:remove var="success" scope="session" />
Your notification here.
</c:if>
答案有幫助嗎? – BalusC 2011-05-27 20:37:28