ForwardAction 类FofrForwardAction类专门用于请求转发,不进行任何其它业务操作。实现的功能类似于JSP动作<jsp:forward>,使用ForwardAction类意味着请求转发是通过控制器完成的。IncludeAction 类IncludeAction的用法与ForwardAction的用法比较相似,区别在于ForwardAction将跳转到action 定义的资源,而IncludeAction用于引入该action 对应的资源。其功能等于<jsp:include>和RequestDispatcher的include()方法。例子:Struts.config.xml配置:< action-mappings >< action path = "/fatest" type = "org.apache.struts.actions.ForwardAction" parameter = "/fa.jsp" ></ action >< action path = "/iatest" type = "org.apache.struts.actions.IncludeAction" parameter = "/ia.jsp" ></ action ></ action-mappings >Path: action 的匹配路径,直接在配置文件中为其命名。type: 要实现的action类parameter: 指定往哪里转发。这三个参数。必须。其它可以省略。HTML代码如下:<a href="./fatest.do">FowradAction类测试</a><br/> <a href="./iatest.do">IncludeAction类测试</a>
ForwardAction类和IncludeActin类
最新推荐文章于 2025-04-12 14:16:11 发布