Struts2下的<result>中的type整理

1.<result name="处理结果名" type="相应结果类型">“响应内容”</result>

解释:name的值shift指的<action>下的method的类的返回值。如下图所示:

2.type

2.1   dispatcher  转发

解释:默认值  ,默认属性<param name="location">"内部资源的URL</param>   只能转发到内部的URL,包括WEB-INF下的

2.2    redirect   重定向   

解释:

  重定向默认属性<param name="location">"内部或外部资源的URL</param>

  外部资源的URL 以http://开头
  不能重定向到WEB-INF下的资源

2.3  redirectAction 重定向到action

解释:

  默认属性<param name="actionName">action的名字</param>
  不能传递action的状态(未做过多解释)也就是不能传递

2.4chain 转发到action

解释:

  默认属性<param name="actionName">action的名字</param>
  能传递action的状态
  <param name="method" >制定目标Action类的方法名</param>
  优先级要高于目标<action>设置的method
  实现action链

原文地址:https://www.cnblogs.com/liuyanzeng/p/6062858.html