i dont think it is really all that different. just think of the difference
between comparing by ref and by val, and using .equals() makes perfect
sense. when you use the == operator you are asking whether the objects
refer to the same place in memory, whereas with .equals() you are asking
whether their values are equivalent. thats a powerful piece of
flexibility--one that you have elsewhere as well..
bradley mclain
>From: Divya M A <[EMAIL PROTECTED]>
>Reply-To: Divya M A <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: Re: Using query string values in JSP
>Date: Mon, 27 Mar 2000 17:30:12 -0500
>
>Thanx a lot for the help.
>As suggested, I used 'if (request.getParameter("val") != null &&
>request.getParameter("val").equals("1"))' and it works beautifully. Wonder
>what else here(JSP/Java) is very different from the other programming
>languages!?!
>
>----- Original Message -----
>From: Mike McKechnie <[EMAIL PROTECTED]>
>To: Divya M A <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
>Sent: Monday, March 27, 2000 4:55 PM
>Subject: Re: Using query string values in JSP
>
>
> > > if (request.getParameter("val") == "1")
> >
> > In Java, the '==' operator does an identity comparison -- that is, two
> > object references are equal only if they refer to the same object.
> >
> > To lexically compare two strings, do something like:
> >
> > if (request.getParameter("val") != null &&
> > request.getParameter("val").equals("1"))
> > {
> > ...
> > }
> >
> >
>
>===========================================================================
>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