Débora
Débora

Reputation: 5952

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.

Upvotes: 0

Views: 762

Answers (1)

Victor
Victor

Reputation: 3818

Struts uses Commons Validator. You can use its validators in your code where you want (e.g. 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).

Upvotes: 1

Related Questions