File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Whats wrong? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Whats wrong?" Watch "Whats wrong?" New topic
Author

Whats wrong?

vinuharan haran
Ranch Hand

Joined: Feb 26, 2005
Posts: 64
I get username and password in a form.I use a servlet to vaidate those parameters.
The strange thing is..
Even though the password entered and the one in database seem to be same( i verified this by printing out)....the code fails to match.
The following line always returns false.
(password is the one entered in the form and opassword is the one retrived from database.)
I use mysql database.What am i missing here?
Thanks,
vinu.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60765
    
  65

Basic Java. The == operator is a test for identity, not equality. To compare string values, use the equals() method.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60765
    
  65

Also, please read this regarding your choice of subject text.
vinuharan haran
Ranch Hand

Joined: Feb 26, 2005
Posts: 64
oooooops...i totally got lost...
next time will post my doubts with good subjectline...sorry about that..
thanks for the reply.
vinu.
[ July 25, 2006: Message edited by: vinuharan haran ]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Whats wrong?
 
Similar Threads
Password Encryption
Store JDBC connection password
char to binary
encrypting passwords
Make a program with jsp