Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

numeric field validation using struts

 
ashish kulkarni
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Has any one done input validation of numeric fields in
struts, like i want to validate number of digits after
decimal or lenght of the numeric field
like the valid values will be 123.34, but 1234.4 is invalid,
I am using dynavalidatorform , so would like some code
to put in validation.xml or in strutsvalidator
does any one have this kind of validation code,
 
John Rainey
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are a standard number of validations that struts provides which are listed in the validator-rules.xml file. If you need to implement your own custom validations, you can add another rule to that xml file or create a new file to put your rule in. You just have to make sure to add it to the struts-config.xml file. To make your own rule, you just have to follow the standard method signature that the normal rules follow.
Let me know if this helps.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic