<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.5//EN" "http://struts.apache.org/dtds/struts-2.5.dtd"> <struts> <constant name="struts.objectFactory" value="org.apache.struts2.spring.StrutsSpringObjectFactory" /> <constant name="struts.enable.DynamicMethodInvocation" value="false" /> <constant name="struts.devMode" value="true"></constant> <constant name="struts.action.extension" value="action"></constant>
<package name="all" namespace="/" extends="json-default,struts-default"> <!-- 不加这句 2.1以上的Struts 不能使用通配符 --> <global-allowed-methods>regex:.*</global-allowed-methods> <!-- 所有ACTION --> <action name="*_*" class="action.{1}Action" method="{2}"> <result type="json" name="map"> <param name="root">dataMap</param> </result>
<result type="json" name="list"> <param name="root">dataList</param> </result>
<result type="json" name="json"> <param name="root">dataJson</param> </result>
<!-- 明文 <result type="plainText" name="str"> <param name="root">dataStr</param> </result> -->
<!-- 流 --> <result type="stream" name="stream"> <param name="root">dataStream</param> </result>
<result type="postback" name="postback"> <param name="root">datapostback</param> </result>
</action> </package>
</struts>