File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to validate textboxes in a jsp page like the asp page of in .NET

 
achuthan mukundarajan
Ranch Hand
Posts: 87
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a jsp page with three textboxes , i need to validate if they are empty or not

Some sites suggest javascript.

There is a button in the form which transfers the values from the three textboxes onto a servlet. So if i leave the three textboxes as blank , then when i press the submit button i should see messages (in the jsp page itself) that the three fields are required?

How do i do it without javascript?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64178
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If this were 1998, you'd submit the page and have the page re-displayed with the error messages. But this is 2012 and you'd use JavaScript.

Of course, you still need to validate on the server. Never assume that client-side validation has executed.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic