This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I would like to use some of the validations that the validator framework comes with, but all of my values have commas in them. How would I strip out the comma values and then use a validation such as floatRange. Ideally I would like to be able to validate all cash quantities. 10,000 as well as 10.58 as valid.
You could probably use the mask built-in validation. Another option I can think of is to create your own validation and register it with validation.xml, but unfortunately the Struts Validator guide doesn't seem to say much about how to do that.
You're pretty much going to having to write your own validation.
It's not that hard. Just create a new class/method that you point to with the validator-rules.xml. If you have problems with it or face a lack direction just post concerns.
If you wish to reuse some of the framework's functionality, you can use the GenericValidator from your customized method to handle range and float validation.
A good workman is known by his tools.
Joined: Sep 28, 2002
I'm thinking I have to create my own validation method that really doesnt validate but formats the value, and then follow it up with dependant validations.