<action name="createAction" class="MyAction" method="create">
<result type="redirectAction" name="success">
<param name="actionName">showAction</param>
<param name="id">${aEntry.aId}</param>
</result>
<interceptor-ref name="login"></interceptor-ref>
</action>
/showAction?id=${aEntry.aId}
json
struts2-json-plugin-2.x.x.jar 中有个 struts-plugin.xml
<package name="json-default" extends="struts-default">
<result-types>
<result-type name="json" class="org.apache.struts2.json.JSONResult"/>
</result-types>
<interceptors>
<interceptor name="json" class="org.apache.struts2.json.JSONInterceptor"/>
</interceptors>
</package>
把你自己的package继承 json-default
<package name="json" extends="json-default" namespace="/json">
<action name="jsonQuery" class="com.xxxxx.CCCAction" method="jsonQuery">
<result type="json" />
</action>
</package>
action 里面return SUCCESS 就好了
他默认的返回结果是把Action里面所有的实列变量序列化(json化)返回来