Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Validation in jsp

 
RaviSingh Kumar
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to our HTML/Javascript forum
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64631
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64631
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic