
June 1st, 2001, 08:43 AM
|
|
Junior Member
|
|
Join Date: Jun 2000
Posts: 12
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Comparing getString to String problem
I have some JSP code that's comparing a String value from a database and a hardcode value set in JSP...
String myName = "Terry";
tmp = r.getString("fname");
if (String.valueOf(tmp) == String.valueOf(myName))
{
System.out.println("You da man!");
}
else
{
System.out.println("-" + tmp + "- != -" + tmp2 + "-");
}
This code prints:
-Terry- != -Terry-
It seems like they are different variable type (getString and String) and aren't being compared properly. I was wondering if there was some way to convert getString to be compatiable with String.
Thanks for help,
Terry
|