1. Struts2 framework validation execution sequence: 1) First, the validation framework (xml file) is executed)
2) perform the validation method of the custom method (validateMyExecute)
3) execute the validate method 2. Input Validation of the custom method in Action. For the custom method specified by the method attribute of action, the corresponding custom input verification method is validateMyExecute (assume that the custom method is myExecute ). The underlying layer is called through reflection.
Note: When a custom execute method is specified in the Action, the input verification method corresponding to the custom execute method is executed first, and then the validate method is executed, after the execution is completed, if any errors occur, the custom task will not be executed again.
The xecute method redirects the process to the page corresponding to the input name.
3. Custom Field-level error message 1) create a new properties file named by Action, as shown in
RegisterAction. properties.
2) Specify the error message for each error field in the property file.
Invalid. fieldvalue. birthday = birthday invalid !!
4. Struts2 Verification Framework (a valid xml file ). Specifically, it can be divided into the field priority validator and the priority validator.
5. The naming rules for international resource files are package _ language name_country name,
For example, package_zh_CN, package_en_US
NOTE: For the result configuration of the struts. xml file, the local configuration is better than the global configuration.
We can either define exceptions and results in actions, or define global exceptions and results. Local exceptions are always better than global ones. If they are defined as global ones, they can be shared by all actions, local exceptions and results can only be exclusive to the current Action and cannot be shared by other actions.
You are welcome to join us in the discussion and study!
Collect it by yourself!
Record and share, let you grow together! Welcome to my other blog; my blog address: http://blog.csdn.net/caicongyang