A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
EJB 3 in Action
this week in the
EJB and other Java EE Technologies
Validation in JSP.
Joined: Jul 26, 2006
Sep 28, 2006 08:05:00
I have a form with 3 fields in a form, UserName, City, Country. Length of each field should not exceed 10 characters. If it exceeds it, the page should be reloaded with error message on the same line of the text box.
Can anybody tell me how I can do it?
Joined: Sep 16, 2004
Sep 28, 2006 08:12:00
attribute, it will not allow user to enter 11th character at first place.
My blood is tested +ve for Java.
Author and ninkuma
Joined: Jan 10, 2002
Sep 28, 2006 08:31:00
Unless a malicious user writes his own form to submit to your server.
Point is, client-side validation
should never be trusted
Yes, go ahead and add the maxlength attribute -- that's good for users since they cannot enter too many characters. But also check the length when the code is submitted.
In fact, validation should occur at every layer in the app in case someone is trying to spoof the upper layers. It also makes your code more robust and re-usable.
Asking smart questions
Books by Bear
Did you see how Paul
cut 87% off of his electric heat bill with 82 watts of micro heaters
subject: Validation in JSP.
form inside a from
How to avoid validation if request was done by GET method?
How to carry the values to the form
How to use Two Action forms into one ActionClass?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014