mapping.findForward("") 得到struts-config 已經配置好的forward

mapping.findForward("") 得到struts-config 已經配置好的forward
比如

<action path="/HelloWorld" type="hello.HelloAction"
name="HelloForm" scope="request" validate="true"
input="/hello.jsp">
<forward name="SayHello" path="/hello.jsp" />
</action>

可以通過
mapping.findForward("SayHello") 轉向hello.jsp

new ActionForward ("hello.jsp")與它效果一樣
只是上面的寫法規範一點 方便配置
傳值:用new ActionForward的方式返回你要返回的頁面並帶上一個參數如:url?success=1,然後在url的頁面中用下面語句彈出窗口:
<c:if test="${param.success=='1'}">
<script>
alert("你要提示的信息");//或用window.open彈出一個新窗體
</script>
</c:if>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章