• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Anoopk Kumar
Greenhorn
Posts: 3
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9320
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic