• 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

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..
 
I didn't say it. I'm just telling you what this tiny ad said.
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic