Hi Jeromy and Lukasz, Thanks for your reply, the information provided by you is really helpful. i could understand well about validation framework with your explanation.
Thanks a lot. On Mon, Jun 30, 2008 at 1:45 PM, Jeromy Evans < [EMAIL PROTECTED]> wrote: > Narayana S wrote: > >> Hi, >> >> as per my understanding, we can implement validations in struts 2 in >> the >> following ways... >> >> 1. overriding validate() method in Action class >> >> > > Use the validate() method for complex validation that cannot be implement > anywhere else. You want to avoid duplicating validation code so this method > should be for special cases. > > 2. writing ActionClass-validation.xml file >> >> > > The XML validation was developed first before Java 5 annotations can be > assumed. It is a little more mature than annotations but some people > doesn't like having to manage more configuration files. > > > 3. using validator annotations >> >> >> > The annotations implement much of what is available in XML and avoid the > separate configuration. There are some complications when using annotations > but generally they're fine. Sometimes I've found the validation annotations > are longer than the actual code, which is a bad thing. I prefer XML, many > people prefer annotations. > > > and how can i implement client side validations in struts 2? >> >> > > The struts 2 form tags have client-side validation built-in if you set > validate=true on the form. > What actually happens is that a loop in the form's closing-tag template > reads the validations from the xml/annotations of your action and generates > some javascript implementing whatever validation logic it can from the > client-side. The benefit is that one validation declaration can be used for > both client and server-side. However it can't implement all validation > logic, it assumes you're using struts2 tags and markup for all fields and it > generates inline javascript. > > See: > http://struts.apache.org/2.0.11.1/docs/client-side-validation.html > > regards, > Jeromy Evans > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >