Method:
1. Verify in the action class in the Execute () method.
Pros: The action class does not have to inherit classes from the framework.
Cons: (1) when there are multiple checksums, the code repeats, violating high cohesion and low coupling.
2. Rewrite the Validate () method in the framework Actionsupport class.
Pros: Contains the This.addfielderror () method, and once invoked, the action ends.
Cons: (1) need to inherit the Actionsupport class (intrusive) in the framework.
(2) Disadvantage of Method 1 (1).
3. Use multiple ValidateXxx () methods, XXX is the method name, and the first letter is capitalized.
Advantages: Separate multiple checks, clear structure.
Disadvantages: (1) Method 2 of the (1) disadvantage.
(2) cannot be reused.
4. Use the STRUTS2 built-in checker.
Pros: Just call, simple, fast.
Cons: (1) You need to use the specified jar package.
(2) More invasive.
Struts2 Data Calibration method