File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes Amout validation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Amout validation " Watch "Amout validation " New topic

Amout validation

Mary Cole
Ranch Hand

Joined: Dec 02, 2000
Posts: 362
how do i validate amount field not to accept characters ?
Abiodun Adisa
Ranch Hand

Joined: Jan 17, 2002
Posts: 495
Originally posted by Mary Cole:
how do i validate amount field not to accept characters ?

you can create a validator , or look for one around that validates for numbers
Cindy Smith

Joined: Nov 26, 2007
Posts: 18
You don't have to do anything extra. If the field on the form is bound to a numeric data type on the backing bean, the validation is done for you. If you type a character in the field you will get a conversion error message. Something like this: Specified value is not a valid number.
Hope this helps.
vaitheeswaran subramanian

Joined: Jan 06, 2005
Posts: 15
Additional you may additional add a validate constraint. In IBM jsf, this is what I do.

<hx:validateConstraint regex="^-?\d+(\.\d{2})?$" />
I agree. Here's the link:
subject: Amout validation
It's not a secret anymore!