File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes Validation in jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Validation in jsp" Watch "Validation in jsp" New topic
Author

Validation in jsp

RaviSingh Kumar
Ranch Hand

Joined: Sep 04, 2007
Posts: 52
Hi,

I am using javascript for clientside validation of TextField in JSP.
For that i am using 'alerts' to show error message.

But i want to show error message just next to the textfield which is
incorrect instead of alerts.

Waiting for some solution to this.

Thanks in advance.
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

hi ravi sing,

if you want to display error message near to the particular field,then you can go for ajax or serverside validation...

if you go serverside validation then using expression(or sriptlet)we can display message ..where ever you want..but page will be refresh..so, you go for ajax(example you see gmail login page by giving wrong username ..you want that type only right?)

thanks & regards,
seetharaman
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Moving to our HTML/Javascript forum


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

Joined: Jan 10, 2002
Posts: 60041
    
  65

if you want to display error message near to the particular field,then you can go for ajax or serverside validation...

Of course not. Whether validation is done n the client or the server has nothing to do with placing the message next to the text field.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60041
    
  65

Explore the innerHTML property of DOM elements to see how to add content to an element.

With regards to validation: while client-side validation is nice for the user, your server code should never rely upon it and should always re-validate the data regardless of whether it was validated on the client or not.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Validation in jsp
 
Similar Threads
GWT Mark Invalid
Validation in Struts
struts validator validation.xml
Validation Form Error Message Location
Spring Web-Flow Richfaces Client Side Validations