This is not really a Tomcat question, but a matter of Java language
understanding.
Comparators like ==, >, <=, etc. should only be used with java language
primitive types, such as int, byte, boolean, and NOT with Objects, like
String, as you are, UNLESS you actually wish to test whether the two
things you are comparing are the same object instance. To test whether
two distinct objects represent the same value or entity, use the equals
method. So in your case, you should use:
if (Pippo.equals("on")) { ... }
or
if (Pippo.equals(Pluto)) { ... }
Please respond to "Tomcat Users List" <[email protected]>
To: "'Tomcat Users List'" <[email protected]>
cc:
Subject: "if" don't work?!?!?
Hi guy!
Wat's happen??
If i read an checkrequest post
String Pippo = request.getParameter("abilitato");
out.print(Pippo);
return me= on
If I try to make a condition whit if:
if (Pippo == "on") {
............
}
these don't work
And is'nt the first time,
if I try
Pippo = request.getParameter("abilitato");
Pluto = request.getParameter("abilitato");
the if (Pippo == Pluto ) don't work!
:-(
please, help me!
Massimiliano PASQUALONI
Data Processing S.r.l.
Reparto EDP
S.S. 100 BA-TA Km 18
c/o "IL BARICENTRO"
torre D
70010 CASAMASSIMA (BA)