On Fri, 21 Jun 2002, Lance Prais wrote:

> I am through confused to as one the following if statement is not working:
> Could someone please look at it and let me know what I am doing wrong.  As
> you can see it is very simple.   You will se the output below the code
> <%@ page language="java" %>
> <%@ page import="java.util.*" %>
> <%@ page import="java.net.*" %>
>
> <%
>         String Collection="";
>         Collection = request.getParameter("collection");
> %>
> <%=Collection%>
>
>                 <%
> if (request.getParameter("collection")=="scopus")
>                 {%>
> You
>                 <%}
>                 else if (Collection=="securetrak")

You are not checking equality of Strings here, but rather identity of
Object references (likewise in the above if).  Try

  else if (Collection.equals("securetrak"))

instead.

It looks like you had another post showing some syntax errors, but if
you don't show the entire code, we can't tell what the exact problem is.

>                 {%>
> me
>                 <%}
>                  else
>                 {%>
> they
>                 <%}%>
>
>
> OUTPUT:
> scopus they
>
> As you can see it is recognizing the "Collection "  but  ignoring the
> Statement.
>
> Thank you in advance
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>

Milt Epstein
Research Programmer
Systems and Technology Services (STS)
Campus Information Technologies and Educational Services (CITES)
University of Illinois at Urbana-Champaign (UIUC)
[EMAIL PROTECTED]

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to