You have to do

if (color.equals("red"))
   whatever1
else 
   whatever2

The equals() method compares the values of the strings.  Using the '=='
compares the string objects themselves.

Bob

-----Original Message-----
From: "Villén Pizarro, Julia" [mailto:[EMAIL PROTECTED]]

I call my_page.jsp this way
http://my_server/my_page.jsp?color=red

Then I retrieve the value of the parameter "color" and then try to match it,
in the following way:

<%
String color;
color=request.getParameter("color")
if (color=="red") {
        whatever1
}
else {whatever2}

%>

The answer is whatever2. I made sure the page is getting the parameter right
by writing it out. The question is
if I have to do any kind of casting.

==========================================================================To 
unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to