Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Login Validation

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My code below don't validate from the database whether it is a valid user.WHY??It just print the Hi and the name.???


(Marilyn added code tags)
[ September 01, 2005: Message edited by: Marilyn de Queiroz ]
 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
At a glance, it looks okay to me.

Do you get any sql exceptions? Is your ResultSet always empty?

By the way, it's preferable to use preparedStatement because in your code, if my password is "' or 1=1", I think I can mess up your stuff, where else in preparedStatment, the input strings are masked.

Also, it is a good practice to close your resultset too.
 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It looks to me like you are over using the <html><body></body></html> tags. You really should only have one of each of these in your generated html code. You appear to be adding muliple copies of these in your resulting page. Check the source of your generated page in your browser to see what is actually on the page. Don't rely on what you see within the browser. It can be misleading.
 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I agree with LEE. you can't have more than one <HTML><BODY></BODY></HTML> tag in a single page. just keep a single set of the above mentioned tag. In your check() , just add the <H2> tag.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Unqualified Genius,

It appears that you have a lot of knowledge about Servlet programming and and are capable of contributing a lot to this forum. I hope that you will conform to the Javaranch naming policy as David has requested in several threads so that your account will remain open.

Looking forward to your future contribution.
-Ben
[ September 05, 2005: Message edited by: Ben Souther ]
 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic