scripter73
Programmer
I have the following in a .jsp that's called from a form:
String myString = request.getParameter("formfield");
If the user doesn't enter anything in "formfield", it should be blank.
So how come when I say:
if (myString == "") //representing null
out.println("field is blank");
It doesn't print anything. However, if I try to print myString, it is blank.
Am I testing a null string correctly?
Thanks.
Change Your Thinking, Change Your Life.
String myString = request.getParameter("formfield");
If the user doesn't enter anything in "formfield", it should be blank.
So how come when I say:
if (myString == "") //representing null
out.println("field is blank");
It doesn't print anything. However, if I try to print myString, it is blank.
Am I testing a null string correctly?
Thanks.
Change Your Thinking, Change Your Life.