简体   繁体   中英

Struts 1.2 validation framework: a separate class for validations

I want to validate user inputs. Struts 1.2 provides a validation framework itself. But its validation is not enough for me. Also I don't like to put my validation (because it may have more codes and logic) into the Form class and need to keep separately from Action class's business logic and Form class. Is there any way to use a separate validate class in Struts 1.2 ? Any useful link with sample code snippets would be appreciated.

Struts uses Commons Validator . You can use its validators in your code where you want (eg your action extracts data from form bean into POJO and invokes business logic, and only then business logic uses Calendar validator to check entered dates).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM