动作映射
<action name="test" class="com.val.Test" >
<result type="stream">
<param name="contentType">text/html</param>
<param name="inputName">inputStream</param>
</result>
<interceptor-ref name="jsonValidationWorkflowStack">
</interceptor-ref>
</action>
测试验证.xml
<validators>
<field name="name">
<field-validator type="required" >
<message>You must select a name</message>
</field-validator>
</field>
</validators>
当我要求/test?name=21&struts.enableJSONValidation=true
得到了回应
{ "fieldErrors": {"name":["You must select a name"]}}