This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi Sreenivas, sorry that i am not giving you any answer.As i have doubt similar to you i am posting reply here.
Normally we have form class in struts application where we define error messages for validation.But for the one which are retrieved dynamically and do not have any form class,where we can define action errors.Can any one help me in this issue.I already defined fields in validation.xml file.But want to define action errors where can i do this.Or there is no way in struts to do it.Can any one help.
For server-side validation, one way is to write the code in the validate method of form-bean. But again, if you use the validator, the form-bean class must extend ValidatorForm class (or DynaValidatorForm and so on), which automatically creates the validate method for you. so you do not need to code for the validate method yourself.
So, you can use any of the option you like for your code. I hope this was helpful. - Meera.
It is really not that complicated. There is the validator framework that supports both server-side and client-side validations. You define you validation rules in just one place (validation.xml). In this case your action forms should extend ValidatorForm. The implementation of the validate method in ValidatorForm calls the validator framework.
You can also choose to not use the validator framework and write your own validation code in the validate method of your form. This is really not that much work and it is a valid strategy. You can also use a combination of rules defined using the validator framework and your own validation in the validate method (be sure to call super.validate()).
anuradha: I don't really understand what you are asking?
Joined: Jan 09, 2007
"You can also use a combination of rules defined using the validator framework and your own validation in the validate method (be sure to call super.validate())."
Joined: Feb 08, 2006