Possible reasons why the Struts2 verification framework does not work

Source: Internet
Author: User

Possible reasons why the Struts2 verification framework does not work
1. Whether the name complies with the Conventions:
-Validation. xml
-- Validation. xml
2. Check whether the validation. xml tag is correct, such as whether to disable all tags and whether to disable one more tag. Note: There are no prompts for this error, but verification does not work.
3. Whether the name of fieldName is consistent with the attributes in jsp and action, for example:
Action has the userName attribute,
Jsp has tags:
Validation. xml must include: ...
The above three usernames must be consistent.
4. Check whether duplicate parameters are configured in the same field. Duplicate parameters may make your information unavailable.
5. Remember that the error message generated by the verification framework is written into fielderror, so you must use it on the page where the error message needs to be displayed.
Tag
Unavailable

6. The most important possibility is that if your Action class does not inherit the ActionSupport class, the page flow will not be automatically redirected.

 

 

In addition to the above several possibilities, it is also necessary to put the configuration verification file in the same directory of Action, but also the actionAlias naming problem.

The actionAlias and action method names must be distinguished.
For example:

The name defines actionAlias.
The method defines the action method name.

I mistakenly used the authentication xml file name as a xxxAction-save-validation.xml,
Life and death cannot be verified
After switching to xxxAction-savexxx-validation.xml, normal
Khan
 

Related Article

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.