This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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: 60049
    
  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: 60049
    
  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 ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Whats wrong?
 
Similar Threads
Password Encryption
Make a program with jsp
char to binary
Store JDBC connection password
encrypting passwords