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

validation of input field

Makhana Jiggu

Joined: Nov 09, 2005
Posts: 11
I need to validate a field to allow only decimal values
eg 10.2 or 10.0 or 10 is acceptable
It can have only 2 digits before the decimal point and can have only one digit after the decimal point. How can i check this.
Any sample code is helpful

Ben Souther

Joined: Dec 11, 2004
Posts: 13410

Duplicate of:

The question has been answered in the other thread.
In the future, please don't post the same question to multiple forums.
This is called cross-posting and is considered to be very rude.
It wastes the time of the people who are trying to help you.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63852


There aren't may rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Forum Bartender

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: validation of input field
jQuery in Action, 3rd edition