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

Client side validation using JSP ???

Anjali Sen

Joined: Feb 26, 2003
Posts: 15
I know client side validation using JSP is not good. but my client side req. is like this. can u any one tell me how to effectively use JSP for
client side validation. pls provide me some sample code or urls.
With Regards,
Andy Bowes
Ranch Hand

Joined: Jan 14, 2003
Posts: 171
The only way to to client-side validation is to have code in the browser. This means it will have to be JavaScript not JSP.
There are obviously issues about portability between browsers and users disabling JavaScript etc. A lot will depend upon the intended audience of the application (e.g. is it Internet or Intranet based) and how much control that you have over the version and settings of their browsers.
You will probably need to provide validation in 2 places:
1) Initial validation client-side using JavaScript to enusre that they have filled in all mandatory fields, that numbers are valid etc.
2) Server-side. Repeat the validation in part 1 to cater for the fact that some users may have disabled JavaScript and add additional validation that can access the database to perform consistency checks.
Hope this helps

Andy Bowes<br />SCJP, SCWCD<br />I like deadlines, I love the whoosing noise they make as they go flying past - Douglas Adams
Chris Baron
Ranch Hand

Joined: Mar 21, 2003
Posts: 1061
Hi Anjali,
an example for JavaScript-Validation:

post, if you have questions about it
I agree. Here's the link:
subject: Client side validation using JSP ???
It's not a secret anymore!