aspose file tools*
The moose likes Struts and the fly likes validations in struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "validations in struts" Watch "validations in struts" New topic
Author

validations in struts

haritha hari
Greenhorn

Joined: Nov 14, 2012
Posts: 29

Hai friends,

I am working on struts validation

validation.xml file is



And my action form is




For validating we are use validate.xml file right...?
but why we need to use validate method in action form

please tell me......

thanq in advance
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8713
    
    6

haritha hari wrote: why we need to use validate method in action form


You do not. I find it useful to do simple validation with XML validation (see if a required field is filled in) and more complex validation in the Java code (make sure a field is in a set of values).
You can also create your own validators to take care of more complex cases.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Shailesh Kumar Saxena
Greenhorn

Joined: Dec 15, 2012
Posts: 25

Hi Haritha

As i know, we use validate.xml (or any name like validator-user.xml....) to configure the dynamic validator plugin generated validation rules.
Struts supplied validator plugin provides approx 14 validation rules. But moreover if we need our manual validation rules along with validator
plugin supplied validation rules then for this purpose we can write our own logic in action form class validate(--) method.
If you are in no need of your own manually developed validation rules, there is no need of taking the validate(--) method in your action form class.

I hope this will help you


Shailesh Saxena,
Pilibhit, U.P. INDIA
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: validations in struts
 
Similar Threads
Doubt in Action Form
Validating forms
how to do validation in struts1
How to display error message
Help needed in resource file