request.getParameter()

when retrieving input from an html form, what type does the request.getParameter() return? My problem is that i can store it into a String and of course i can even print it as a String, but why can't I compare it with a String (inside an if-statement for example)?
[272 byte] By [akisa] at [2007-10-3 3:50:05]
# 1
Is this a Generics question? if so how?
ejpa at 2007-7-14 21:47:26 > top of Java-index,Core,Core APIs...
# 2

No. what i am asking is this:

Suppose the input from the html form is the word: java.

String str=request.getParameter("input");

out.println(str);// it works. output=java

if(str=="java"){// the problem is here. The control cannot pass

do stuff;// inside the block, as if the str=="java" is false

}

any suggestions?

akisa at 2007-7-14 21:47:26 > top of Java-index,Core,Core APIs...
# 3

1) Pick a more appropriate forum

2) == isn't what you want here

3) If you can't figure out why, think about the context of the question - is this really anything to do with "Generics" (the forum you've chose) or "request.getParameter()" (your thread subject), or is it more to do with comparing two Strings? Once you've figured that out...

4) Pick a more appropriate forum to ask follow-up questions in

:-)

dannyyatesa at 2007-7-14 21:47:26 > top of Java-index,Core,Core APIs...
# 4
never mind. i got it. i have to use equals(). i still don't know though why the pevious doesn't work....
akisa at 2007-7-14 21:47:26 > top of Java-index,Core,Core APIs...
# 5
Java Tutorial might help you... read it.or a direct answer: http://www-128.ibm.com/developerworks/java/library/j-ebb0917a.html
lfschucka at 2007-7-14 21:47:26 > top of Java-index,Core,Core APIs...