Solved

Else If Statement - with one or another variable

Posted on 2004-08-26
2
256 Views
Last Modified: 2010-04-01
Hi, How do I create an if/else statement in which I want it to do the same thing if either of 2 variables are entered? Here is my code:


String mode = request.getParameter("mode");

out.print("<td><center>");
      if (mode.equals("largeimages"))
      {
            String imagenumber = request.getParameter("imagenumber");
            out.print("<a href=\"deleteimages.jsp?mode=" + mode + "&imagenumber=" + imagenumber + "\">");
      } else if (mode.equals("listaccession") OR mode.equals("listaccessionall"))
      {
            String last2 = request.getParameter("last2");
            out.print("<a href=\"deleteimages.jsp?mode=" + mode + "&last2=" + last2 + "\">");
      } else
      {
            out.print("<a href=\"deleteimages.jsp?mode=" + mode + "&series=" + series + "\">");
      }
out.print("<font size=2>Unselect Image</font>");
out.print("</a></center></td>");


Thank you for your help in advance.
AKamauu
0
Comment
Question by:akamauu
2 Comments
 
LVL 3

Accepted Solution

by:
pat5star earned 125 total points
ID: 11908739
    } else if (mode.equals("listaccession") || mode.equals("listaccessionall"))

|| is how you say OR

-Pat
0
 

Author Comment

by:akamauu
ID: 11908872
Thank you ... that worked great.

AKamauu
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
getting param value 7 58
How to set default webapp for host 6 47
Use tracing facilities in your browser steps 2 122
iterator/ListIterator approach 17 39
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question