This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Text Box Validation

 
Pranit Sonawane
Ranch Hand
Posts: 171
Java MySQL Database Netbeans IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all this is my code :
Registration form



and this is the jsp page with which the records will be stored into the database



what i want is if a new user trying to register and enters the same username which is already taken by someone else, he should get an error when he switches to he next text box of username.
 
Prasad Krishnegowda
Ranch Hand
Posts: 665
4
Eclipse IDE Java Spring
  • 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Doing the database operations, inside the JSP.. A Strict NO. Java code inside JSP, was discredited 10 Years back. Move the Logic to Servlets.

As far as your problem is concerned. The solution may be like this.
In your registration.jsp, a small hyperlink, can be made next to username, as checkAvailabality. Once User clicks this, a AJAX operation will be made, that AJAX returns a status as username available or not available, so based on this, a appropriate div in a JSP will be updated. The backend also, as to do validation, before inserting into database and return back the error message, this is for the case if user doesn't use the checkAvailablity link, and just clicks Submit.
 
Pranit Sonawane
Ranch Hand
Posts: 171
Java MySQL Database Netbeans IDE
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Prasad...great help!!!
 
Prasad Krishnegowda
Ranch Hand
Posts: 665
4
Eclipse IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pranit Sonawane wrote:Thanks Prasad...great help!!!

Welcome Brother..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic