• 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

email validation

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have a code in jsp .this code validates whether an email id entered already exists in the database or not ?...... nd it is nt executing. plzz help me out ...

 
Bartender
Posts: 2856
10
Firefox Browser Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi and welcome to Javaranch
Can you elaborate what not executing means?
Also make sure you UseCodeTags for code, makes it more readable. I have added them for you in the post above.
 
Amit Ghorpade
Bartender
Posts: 2856
10
Firefox Browser Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Now for some suggestions on the code itself.
1) Having scriptlet or plain old Java code in JSP is highly outdated, like dinosaur age. All your code should be a servlet, it is doint nothing good for a JSP.
2) You need to rethink the SQL query you are using, among other things, it will be a victim of SQL injection.
3) It is a good practice to use appropriate variable names. Having "name" refer to an email only attracts confusion.

When you fix these, there are more improvements that can be done.
 
Greenhorn
Posts: 6
IntelliJ IDE Redhat Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think your SQL query is not checking the email address correctly.

Come up with a SQL query which works for all the cases and then convert it into a query string in your code.

Try to use "like" keyword in SQL.

hope this helps.
 
reply
    Bookmark Topic Watch Topic
  • New Topic