This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

email validation  RSS feed

 
Tulsi Hemrajani
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • 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 ...

 
Amit Ghorpade
Bartender
Posts: 2856
10
Fedora Firefox Browser Java
  • Mark post as helpful
  • send pies
  • 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
Fedora Firefox Browser Java
  • Mark post as helpful
  • send pies
  • 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.
 
Siva Meka
Greenhorn
Posts: 6
IntelliJ IDE Java Redhat
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!