File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes How to validate textboxes in a jsp page like the asp page of in .NET Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "How to validate textboxes in a jsp page like the asp page of in .NET" Watch "How to validate textboxes in a jsp page like the asp page of in .NET" New topic
Author

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

achuthan mukundarajan
Ranch Hand

Joined: May 30, 2012
Posts: 85
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

Joined: Jan 10, 2002
Posts: 61105
    
  66

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to validate textboxes in a jsp page like the asp page of in .NET