Meaningless Drivel is fun!*
The moose likes Struts and the fly likes validate() method & validation.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "validate() method & validation.xml" Watch "validate() method & validation.xml" New topic
Author

validate() method & validation.xml

Rajni Patel
Ranch Hand

Joined: Sep 03, 2009
Posts: 84
I try to use validate() method and validation.xml both with the same action form with different field, but only validate() method populate but validation.xml rule is not populate. Please anybody could guide me?

for ex: I have
String name,
double salary

2 fields.

I validate name with validate() method and salary with validation.xml
so only from validate() method, name field validate but not salary.

So I am thinking validation.xml and validate() method both can not use for the same action form.
Raza Mohd
Ranch Hand

Joined: Jan 20, 2010
Posts: 247

hi rajni..

I dont think so.

You can use both the validation.xml and the validate() method.

Validate() method is more of server side validation and <Action Name>-validation.xml serves the purpose for both..

but if you are using validation.xml then you dont need to use validate() as it serves the same purpose.



Good luck!!
A small leak can sink a Gigantic ship.>
Rajni Patel
Ranch Hand

Joined: Sep 03, 2009
Posts: 84
Thanks for Reply.


I can not populate both validation. If I comment validate() method then from validation.xml validation is working.

Is there I have to configure any thing special?

Thanks again.
Raza Mohd
Ranch Hand

Joined: Jan 20, 2010
Posts: 247

show me your validation.xml....

Are you using same type in validation.xml as your property type?
Rajni Patel
Ranch Hand

Joined: Sep 03, 2009
Posts: 84
You are write. It is not same. but if comment validate() method then why is it working?

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: validate() method & validation.xml
 
Similar Threads
Struts2 Validations problem
difference between and validate() and validation.xml
How to validate single form field using struts Validatation framework
Struts2 Validation
Struts 2 visitor validation not able to get any error message