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