struts 二 插件

struts 2 插件
Struts 2.0 的codebehind插件
1.添加struts2-codebehind-plugin-2.0.11.2.jar包到应用中
2.struts.xml中添加配置:<constant name="struts.codebehind.pathPrefix" value="/XXX/" />

说明:value的值从项目的根路径开始写。以“/”结尾。

返回页面的路径为struts.codebehind.pathPrefix + package_namespace + action_name + action_execute_returnString + .jsp

例如:

struts.codebehind.pathPrefix  = /WEB-INF/jsp/

package_namespace = /qinya

action_name = hello

action_execute_returnString  为success时,值为空,为其他时,值为"-" + action_execute_returnString

如果:Action类中的 execute() 方法的返回值是:“SUCCESS“,

则显示的页面就是:/WEB-INF/jsp/qinya/hello.jsp

Action类中的 execute() 方法的返回值是:“error“,

则显示的页面就是:/WEB-INF/jsp/qinya/hello-error.jsp

用codebehind插件的时候,在存放页面的地方一定要有和namespace对应的文件夹,不然的话,显示页面的时候会找不到页面而报错。
==============================================================================================
<constant name="struts.action.extension" value="XXXX" />
将action的后缀名改为“XXXX” ,
================================================================================
<constant name="struts.multipart.maxSize" value="2097152"/>
上传最大限制
=======================================================================================
<constant name="struts.devMode" value="true"/>
不会自动加载任何配置文件,配置上这个后如果框架出了异常会有非常详细的异常堆栈打印出来,而不是单纯的404或500页面,看一看一下这个页面,错误信息message已经非常明白的告诉你错误原因了