struts2校验框架

校验配置文件的DTD在xword-core-2.2.3.jar中,系统自带的校验器的xml配置文件是
xword-core-2.2.3.jar里com.opensymphony.xword2.vilidator.validators.default.xml文件

校验配置文件名称必须为
ActionClassName-validation.xml:Action类名-validation.xml
ActionClassName-ActoinAliasName-validation.xml:Action类名-类别名-validation.xml
类别名为在struts.xml中action的name属性名。

在 s:form 中添加validation=”true”属性,这样,客户端会根据服务端校验框架自动生产客户端的javascript语句,在客户端进行验证。

今天我做的时候,爆出了

Java method “org.apache.struts2.components.Form.getValidators(String)” threw an exception when invoked on org.apache.struts2.components.Form object “org.apache.struts2.components.Form@60b8d40e”; see cause exception in the Java stack trace.

网上一搜各种解释都有
struts2类型转换+校验
Struts2.1.8 验证框架(validation)的使用中遇到的一些问题(直接访问jsp遇到的错误)

最后的解决方法

  • 在表单要提交的Action后面加上 .action
  • struts.xml
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE struts PUBLIC"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN""http://struts.apache.org/dtds/struts-2.3.dtd"><struts><constant name="struts.devMode" value="true"/><constant name="struts.custom.i18n.resources" value="message"/><package name="alc" namespace="/" extends="struts-default"><action name="register" class="S043.Register"><result name="success">/success.jsp</result><result name="input">/index.jsp</result></action><action name="index"><result>/index.jsp</result></action></package>
</struts>

转载于:https://www.cnblogs.com/A-yes/p/9894198.html

ava method org.apache.struts2.components.Form.getValidators(String) threw an exception when invoke相关推荐

  1. org.apache.struts2.dispatcher.FilterDispatcher的四个功能

    org.apache.struts2.dispatcher.FilterDispatcher的四个功能 2008-05-24 11:16 1.org.apache.struts2.dispatcher ...

  2. Apache Struts2(S2-045)漏洞反思总结

    2017的3.8-3.9号,Apache Struts2出现漏洞,该漏洞影响范围广,危害级别高.轻则系统文件感染,严重则系统瘫痪. 国家信息安全漏洞库(CNNVD)收到关于Apache Struts2 ...

  3. 问题解决:org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter

    问题解决:org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter 参考文章: (1)问题解决:org.apache. ...

  4. org.apache.struts2.json.JSONException: org.hibernate.LazyInitializationException: failed to lazily i

    数据转换成json数据失败,封装的实体类中有集合字段,在get方法上面加@JSON(serialize=false)注解 @JSON(serialize=false) public Set<Su ...

  5. SpringBoot项目启动提示:An attempt was made to call the method org.apache.coyote.AbstractProtocol.setAccept

    场景 在Eclipse中新建SpringBoot项目后启动项目提示: 具体报错信息如下: . ____ _ __ _ _/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ...

  6. org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter错误解决

    一月 10, 2017 1:50:21 下午 org.apache.catalina.core.StandardContext filterStart 严重: Exception starting f ...

  7. org.apache.struts2.json.JSONWriter can not access a member of class

    偶遇一个问题:org.apache.struts2.json.JSONWriter can not access a member of class  org.apache.tomcat.dbcp.d ...

  8. org.apache.struts2.json.JSONException: java.lang.reflect.InvocationTargetException异常解决

    org.apache.struts2.json.JSONException: java.lang.reflect.InvocationTargetException异常解决 参考文章: (1)org. ...

  9. apache struts linux,Apache Struts2远程代码执行漏洞(S2-053)(CVE-2017-12611)

    Apache Struts2远程代码执行漏洞(S2-053)(CVE-2017-12611) 发布日期:2017-06-23 更新日期:2017-09-11 受影响系统: Apache Group S ...

最新文章

  1. 2021年大数据Flink(二十三):​​​​​​​Watermaker案例演示
  2. 网站外部链接优化如何进一步提升?
  3. DataWorks功能实践速览 05——循环与遍历
  4. bzoj 1031 [JSOI2007]字符加密Cipher 后缀数组
  5. Android之android8.1打开热点提示UID 10140 does not have Location permission和Location mode is enabled.
  6. mysql启动时执行sql server_常见 mysql 启动、运行.sql 文件错误处理
  7. centos删除文件夹_等保测评主机安全之centos密码长度
  8. java中的原子操作_[Java并发系列] 2.Java中的原子操作类
  9. 分享一个Go项目的整洁架构模板
  10. 百度小程序html解析图片过大_如何快速高效爬取谷歌百度必应的图片
  11. 【ACL2020-CMU-Google】MobileBERT:用于资源受限设备的任务无关“瘦版”BERT
  12. js sdk demo java_微信JS-SDK DEMO页面和示例代码
  13. 直觉模糊集的基本要素
  14. Qcom ramdump 解析
  15. 网络地址与直接广播地址有关计算
  16. java有道翻译_java实现有道翻译爬虫
  17. 【Linux学习笔记】关于ubuntu开机菜单栏和任务栏不见了的有效解决方法
  18. 查看获取别人的微信公众号二维码
  19. VoLTE、VoWiFi和VoIP有什么不同?
  20. 安全漏洞中的倚天剑——XSS跨站脚本攻击

热门文章

  1. BZOJ3572 [Hnoi2014]世界树 【虚树 + 树形dp】
  2. unicode 编解码记录
  3. 转 让NET C# 程序独立运行(脱离 .NET Framework运行,绿色运行) 未验证
  4. jquery基本操作笔记
  5. 小强的HTML5移动开发之路(18)——HTML5地理定位
  6. ubuntu上安装nodejs
  7. GoF的23个经典设计模式
  8. 去黑头的7个必胜秘方
  9. 嵌入式linux tftp服务的配置
  10. 【狂人小白】如何将Java项目发布到Maven中