Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Text Box Validation  RSS feed

 
Ranch Hand
Posts: 172
Java MySQL Database Netbeans IDE
  • 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.
 
Ranch Hand
Posts: 672
4
Eclipse IDE Java Spring
  • Likes 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: 172
Java MySQL Database Netbeans IDE
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Prasad...great help!!!
 
Prasad Krishnegowda
Ranch Hand
Posts: 672
4
Eclipse IDE Java Spring
  • 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
Boost this thread!