关于Struts中Validate验证框架的问题: Document is invalid: no grammar found.

  问题:

Parse Error at line 2 column 17: Document is invalid: no grammar found.
org.xml.sax.SAXParseException: Document is invalid: no grammar found.

Parse Error at line 2 column 17: Document root element "form-validation", must match DOCTYPE root "null".
org.xml.sax.SAXParseException: Document root element "form-validation", must match DOCTYPE root "null".

解决方法:

在validation.xml中少写了头代码,在struts1.2中貌似没有自动给你生成,但以前版本有,加上:

          "-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.0//EN" "http://jakarta.apache.org/commons/dtds/validator_1_0_1.dtd">

就可以了.还需要注意的是validator_1_0_1.dtd一定要注意版本,在commons-validator/org.apache.commons.validator.resources下可以找到相应版本.

你可能感兴趣的:(JAVA开发问题)