In java "stringA == stringB" tests to see if the strings are stored in the same 
location in memory.
It does not evaluate the value of the strings. But "stringA.equals(stringB)" evaluates 
the values,
not the memory addresses.

Hope this helps
Corbin

Chris Mcgarel wrote:

> Can someone expalin to a novice why I must use:
>          if (Request.Form("myFormElement").equals("myString"))
> rather than a straight comparison operator:
>         if (Request.Form("myFormElement")=="myString")
> ?
>
> The latter does not work for me even though both left and right sides of the
> statement are Strings.
>
> The full code for form.jsp is:
>
> <body>ody bgcolor=darkblue text=white>
> <font face=arial>
> <%
>     String myTest = "";
>
>     myTest = Request.Form("mySubmit");
>
>     if (myTest=="Click")                        // doesn't work, must be if
> (myTest.equals("Click"))
>     {
>         out.println ("CLICKED!!!");
>     }
>
> %>
>
> <form action="form.jsp">
> <input type=submit name="mySubmit" value="Click">
> </form>
>
> </font>
> </body>
>
> ===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
> FAQs on JSP can be found at:
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to