[thelist] JSP fumbling.....

Chris Johnston chris at fuzzylizard.com
Sat Nov 16 21:30:01 CST 2002


Basically what you are asking for is whether the two strings are the
same object, which obviously they are not.

What you need to use is something like HTTPMethod.equals("POST") to see
if the two strings are equal in value.

On Sat, 2002-11-16 at 21:39, Anthony Baratta wrote:
> Why does this *always* evaluate to false??
>
>    String HTTPMethod = request.getMethod();
>    if (HTTPMethod == "POST") {
>       System.out.println("True");
>    } else {
>       System.out.println("False");
>    }
>
> Yet
>
>       System.out.println(HTTPMethod);
>
> On a form submit prints POST.
>
> I'm stumped.
> ---
> Anthony Baratta
> President
> Keyboard Jockeys
>
> "Conformity is the refuge of the unimaginative."
--
Chris Johnston <chris at fuzzylizard.com>
FuzzyLizard




More information about the thelist mailing list