Struts2 does not validate the data through the configuration file. The struts2 configuration file

Source: Internet
Author: User

Struts2 does not validate the data through the configuration file. The struts2 configuration file
Common network collection solutions: 1. First, pay attention to the validation. xml name, be sure to take the Action class name plus "-validation. xml" as the file name, such as LoginAction-validation.xml. If you only validate a method in LoginAction, you need to add a method name, such as LoginAction-update-validation.xml 2. the LoginAction-validation.xml file must be in the same directory as the Action Class 3. validation. the type property of the <field-validator type = ""> tag in the xml file, refer to xwork-XX.jar --> com. opensymphony. xwork2.validator. validators --> default. xml 4. in struts. the <action> label in the xml file must contain ''' <result name = "input"> and <result name = "success"> ''', otherwise, an error indicating that the result cannot be found will be reported. After the validation. xml fails, the system will return the page where the input is located by default. This solution (DTD error ):

<! DOCTYPE validators PUBLIC "-// Apache Struts // XWork Validator 1.0.3 //" http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd ">
Change
<! DOCTYPE validators PUBLIC "-// OpenSymphony Group // XWork Validator 1.0.3 //" http://www.opensymphony.com/xwork/xwork-validator-1.0.3.dtd ">

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.