• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Text Box Validation

 
Ranch Hand
Posts: 172
Netbeans IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 Spring Java
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Netbeans IDE MySQL Database Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Prasad...great help!!!
 
Prasad Krishnegowda
Ranch Hand
Posts: 672
4
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Pranit Sonawane wrote:Thanks Prasad...great help!!!


Welcome Brother..
 
Don't destroy the earth! That's where I keep all my stuff! Including this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic