aspose 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 Spring in Action this week in the Spring 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: 61434
    
  67

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: 61434
    
  67

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 ]
 
 
subject: Whats wrong?