1. Use the form's validate method to fetch the data from the xml file to check against. 2. Add a custom validator to the validator-rules.xml which can open the xml file to check against. 3. When your action calls your business layer, do the check in the business layer and throw any validation errors back to the action, which should handle to errors and forward to the input page.
I'd prefer method 3 if I had to do any validation against any dynamic content (i.e. does username already exist).
If you have any questions, if sure I or someone else will be able to help you further.
Joined: Apr 20, 2007
Thank you for the reply.
Sorry i did not tell the exact requirement. The project is not a web application.
1) At a particular time (schedular), We have to extract records from collections of tables through JDBC.
2) Once records are fetched, we have to do validations ( data validation and business validation)
From this place i need guidance.
Assume, the records are in ResultSet. I need to do validation in the resultset records.
Please guide me Which is the good approach,
1) Extract record one by one from ResultSet and create POJO for that, and do validation against POJO using struts validation framework. Is it possible?
2) Extract record one by one from ResultSet and create XML file for that record, and do validation against XML file using struts validation framework. Is it possible?
If there is other ways, itself ok.
The final result should be, after the validation I have to store error record with error description and correct record in a seperate file.
I have used struts validation in web applications, not in others.
If you have any links and tutorials to use stuts validation for non web application, please share with me.