在Struts中,通过action跳转jsp,但是有时希望仅仅只是跳转页面,而不需要action,这时可以用ForwardAction。
定义一个仅仅是跳转的ForwardAction如下:
<action-mappings> <!-- 请求的URL对应于<action>中的path属性 --> <action path="/newHelloWorld" type="org.apache.struts.actions.ForwardAction" parameter="/JSP/newHelloWorld.jsp" /> </action-mappings>
这样,在浏览器中输入newHelloWorld.do,就会立即跳转到newHelloWorld.jsp页面。
注:如果发生找不到ForwardAction类的错误,则要包含struts-extras-1.3.10.jar包。