【异常描述】:当使用struts2的表单标签做完服务器端校验后,通过在<s:form>标签添加属性validate="true"添加
客户端校验时,整个火狐页面的表单下方变黄,并出现“FreeMarker template error!”的错误提示,
报异常:freemarker.template.TemplateModelException: Method public java.util.List
org.apache.struts2.components.Form.getValidators(java.lang.String) threw an exception when invoked on
org.apache.struts2.components.Form@150a066
【错误原因】:
1.表单提交的请求没有经过struts2的核心filter过滤。
2.页面中有国际化消息的key。
【解决办法】:
做如下配置,让请求通过struts2转发:
<action name="*">
<result>/WEB-INF/content/{1}.jsp</result>
</action>
说明:通过以上配置,就可以在点击超链接或表单提交时经过struts2的转发。
转载于:https://blog.51cto.com/1689143/1248577