File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes numeric field validation using struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "numeric field validation using struts" Watch "numeric field validation using struts" New topic

numeric field validation using struts

ashish kulkarni
Ranch Hand

Joined: Aug 15, 2002
Posts: 131
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

Joined: Dec 05, 2002
Posts: 17
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.
I agree. Here's the link:
subject: numeric field validation using struts
It's not a secret anymore!