i think that since you are comparing strings you need to use the method
String.equals() for the comparison.

e.g. if(request.getParameter("val").equals("1"){...

bradley mclain

>From: Divya M A <[EMAIL PROTECTED]>
>Reply-To: Divya M A <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: Using query string values in JSP
>Date: Mon, 27 Mar 2000 16:34:07 -0500
>
>Hi!
>    I'm new to JSP. I have a JSP file which must perform a task depending
>on
>the value passed through a query-string in the url. But I am not able to
>make the comparison;i.e,
>if my url is : 'first.jsp?val=1'
>and in the jsp file, I check the value of the string passed as shown below:
>  if (request.getParameter("val") == "1")
>{
>---------
>}
>  This condition is not true though my query string is 'val=1', which I
>understand is a string and the above compare should work fine.
>  My guess was that probably the query string includes a terminator or
>something similar which is not in the hard-coded value("1"), but on
>checking
>the length after assigning both to string variables, the lengths were the
>same. Please note that the comparison of these string variables too gave me
>a negative result.
>Please help.
>
>===========================================================================
>To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
>JSP-INTEREST".
>Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

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

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to