action配置中配置xml返回与json返回
<action name="xx" class="xx" method="xx">
<result name="xmlMessage" type="plainText"></result>
<result name="json" type="json">
<param name="root">ajaxJson</param>
</result>
</action>
public String retXmlOrJson() {
String returnType = null; //返回xml
if(要返回JSON ) {
returnType = "json"; //返回json
}
return returnType
}
<action name="xx" class="xx" method="xx">
<result name="xmlMessage" type="plainText"></result>
<result name="json" type="json">
<param name="root">ajaxJson</param>
</result>
</action>
public String retXmlOrJson() {
String returnType = null; //返回xml
if(要返回JSON ) {
returnType = "json"; //返回json
}
return returnType
}