One final comment. Note that you call request.getParameter() to save the parameter in a string, and then call request.getParameter() again in the if statement. Just use the string field in the if - less overhead. Also fyi you can concatonate multiple package names in 1 import statement.
In a message dated 6/21/2002 11:15:43 PM Eastern Standard Time, [EMAIL PROTECTED] writes:
Subj:If..else issue
Date:6/21/2002 11:15:43 PM Eastern Standard Time
From: [EMAIL PROTECTED] (Lance Prais)
Sender: [EMAIL PROTECTED] (A mailing list for discussion about Sun Microsystem's Java Servlet API Technology.)
Reply-to: [EMAIL PROTECTED] (A mailing list for discussion about Sun Microsystem's Java Servlet API Technology.)
To: [EMAIL PROTECTED]
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")
{%>
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
----------------------- Headers --------------------------------
Return-Path: <[EMAIL PROTECTED]>
Received: from rly-xf01.mx.aol.com (rly-xf01.mail.aol.com [172.20.105.225]) by air-xf01.mail.aol.com (v86_r1.13) with ESMTP id MAILINXF14-0621231542; Fri, 21 Jun 2002 23:15:42 -0400
Received: from swjscmail2.java.sun.com (swjscmail2.sun.com [192.18.99.108]) by rly-xf01.mx.aol.com (v86_r1.13) with ESMTP id MAILRELAYINXF11-0621231518; Fri, 21 Jun 2002 23:15:18 -0400
Received: from swjscmail1 (swjscmail1.Sun.COM [192.18.99.107])
by swjscmail2.java.sun.com (Postfix) with ESMTP
id 3907021235; Fri, 21 Jun 2002 21:13:11 -0600 (MDT)
Received: from JAVA.SUN.COM by JAVA.SUN.COM (LISTSERV-TCP/IP release 1.8d) with
spool id 2047735 for [EMAIL PROTECTED]; Fri, 21 Jun 2002
21:11:41 -0600
Delivered-To: [EMAIL PROTECTED]
Received: from ts.checkpoint.com (holly.ts.checkpoint.com [204.156.136.100]) by
swjscmail1.java.sun.com (Postfix) with ESMTP id AB0214801 for
<[EMAIL PROTECTED]>; Fri, 21 Jun 2002 21:11:40 -0600 (MDT)
Received: from LPRAIS1 (localhost [127.0.0.1]) by ts.checkpoint.com
(8.9.3+Sun/8.9.3/CPHolly/1.3.1) with SMTP id WAA08540 for
<[EMAIL PROTECTED]>; Fri, 21 Jun 2002 22:14:48 -0500 (CDT)
MIME-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0)
Importance: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
Message-ID: <[EMAIL PROTECTED]>
Date: Fri, 21 Jun 2002 22:12:13 -0500
Reply-To: "A mailing list for discussion about Sun Microsystem's Java Servlet API Technology." <[EMAIL PROTECTED]>
Sender: "A mailing list for discussion about Sun Microsystem's Java Servlet API Technology." <[EMAIL PROTECTED]>
From: Lance Prais <[EMAIL PROTECTED]>
Subject: If..else issue
To: [EMAIL PROTECTED]
In-Reply-To: <004801c216c5$8fe1e630$cf03a8c0@marco>
