1. Understanding of the test
Projects, often use more front-end checks, such as the page JS check. For higher security requirements, it is recommended to validate on the service side.
Service-side check:
Control layer Conroller: Verifies the legality of the parameters requested by the page. Conroller checksum on the server-side control layer, with no distinction between client types (browser, mobile client, remote Call)
Business Layer Service (use more): Mainly check the key business parameters, limited to the parameters used in the service interface.
Persistence Layer DAO: It is generally not verified.
2.SPRINGMVC Calibration Requirements
SPRINGMVC uses Hibernate's check frame validation (and hibernate has no relationship).
Calibration ideas:
The parameter of the page submission request, which is requested into the Controller method, is verified with validation. If the checksum error occurs, the error message is displayed to the page.
Specific requirements:
Product modification, add check (check the product name length, the production date of the non-null check), if the check error, the Product modification page displays an error message.
3. Environmental preparedness
4. Configuring the Validator
Configuring in Springmvc.xml
5. Officer the detector into the processor adapter
6. Add a validation rule to the Pojo
7.customvalidationmessages.properties
8. Capturing checksum error messages
9. Display the check error message on the page
SPRINGMVC Learning 11-validation Calibration