含有convention插件的struts.xml文件

<?xmlversion="1.0"encoding="UTF-8"?>

<!DOCTYPEstrutsPUBLIC"-//ApacheSoftwareFoundation//DTDStrutsConfiguration2.1//EN"

"http://struts.apache.org/dtds/struts-2.1.dtd">

<struts>

<constantname="struts.locale"value="zh_CN"/>

<constantname="struts.i18n.encoding"value="UTF-8"/>

<constantname="struts.convention.result.path"value="/WEB-INF/pages/"/>

<constantname="struts.convention.default.parent.package"

value="crud-default"/>

<constantname="struts.convention.package.locators"value="web"/>

<constantname="struts.convention.action.name.lowercase"

value="true"/>

<constantname="struts.convention.action.name.separator"

value="_"/>

<constantname="struts.multipart.maxSize"value="4000000000"/>

<!--用于CRUDAction的parentpackage-->

<packagename="crud-default"extends="convention-default,json-default">

<!--

基于paramsPrepareParamsStack,增加store

interceptor保证actionMessage在redirect后不会丢失

-->

<interceptors>

<interceptor-stackname="crudStack">

<interceptor-refname="store">

<paramname="operationMode">AUTOMATIC</param>

</interceptor-ref>

<interceptor-refname="defaultStack"/>

</interceptor-stack>

</interceptors>

<default-interceptor-refname="crudStack"/>

<global-results>

<resultname="executeResult"type="freemarker">/commons/execute_result.ftl</result>

<resultname="exception"type="freemarker">/commons/exception.ftl</result>

</global-results>

</package>

<!--

使用Convention插件,实现约定大于配置的零配置文件风格.特殊的Result路径在Action类中使用@Result设定.

-->

</struts>

相关推荐