File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Struts 2 XML Validation : How to validate multiple fields with common/single validation code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts 2 XML Validation : How to validate multiple fields with common/single validation code" Watch "Struts 2 XML Validation : How to validate multiple fields with common/single validation code" New topic
Author

Struts 2 XML Validation : How to validate multiple fields with common/single validation code

Anoopk Kumar
Greenhorn

Joined: Oct 08, 2010
Posts: 3

I have a form and multiple numeric fields (num1, num2 ...) which needs to be validated.
Currently I have to write validation for each field again and again..
Is there any way I can apply common validation for all numeric field.
Here is my validation code.

Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8927
    
    9

You can put a validate method in your action class and Struts will invoke it before calling your execute method. I find it to be much more flexible than the XML validator.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts 2 XML Validation : How to validate multiple fields with common/single validation code