日期:2014-05-16 浏览次数:20772 次
struts2 的项目的建立我就不多说了,网上很多。这里就说下 struts.xml 里面关于 result 的配置含义,因为 struts2 会通过这个配置来判断你想要做什么样的操作,是重定向、返回数据还是其他什么的,默认配置的结果类型是dispatcher。具体的 result-type 可以 在struts2-core-2.0.11.1.jar 包或 struts2 源代码中的 struts-default.xml 文件中找到,在这个文件中找到标签,所有的result-type都在里面定义了。
?
| 
 result-type  | 
 class  | 
 说明  | 
| 
 dispatcher  | 
 org.apache.struts2.dispatcher.  | 
 默认结果类型,用来转向页面,通常处理JSP  | 
| 
 chain  | 
 com.opensymphony.xwork2.  | 
 将action和另外一个action链接起来  | 
| 
 freemarker  | 
 org.apache.struts2.views.freemarker.  | 
 处理FreeMarker模板  | 
| 
 httpheader  | 
 org.apache.struts2.dispatcher.  |