【异常描述】:当使用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的转发。
使用struts2 做客户端校验时抛出freemarker模版错误异常的处理
原创文章标签 struts2的客户端校验 文章分类 Java 后端开发
下一篇:我的友情链接
-
Struts2配置异常错误处理(十六)
> 勿以恶小而为之,勿以善小而不为--------------------------刘备> > 劝诸君,多行善
web.xml配置错误界面 tomcat配置错误界面 struts2配置自定义异常 struts2配置异常 java -
Struts2中的异常处理
Struts2中的异常处理
struts sql 异常处理 java 拦截器 -
struts2 freemarker request 对象使用
struts2 freemarker request session parameter 使用Request里的Attribute值最简单的
freemarker #if ip地址 struts -
Struts2异常处理配置
/sql.jsp /root.jsp /index.jsp /success.js...
struts2 sql java struts JAVA