Else If Statement - with one or another variable

Posted on 2004-08-26
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");

      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>");

Thank you for your help in advance.
Question by:akamauu

Accepted Solution

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

|| is how you say OR


Author Comment

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


Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
JTable - RowFilter & Columns Header. 3 140
maven j2ee examles 2 49
eclipse luna javeEE perspecive missing 5 95
listing all functions in JavaScript 19 172
Note: This is the third blog post in a series on email clearinghouses (   We’ve been talki…
In 2017, ransomware will become so virulent and widespread that if you aren’t a victim yourself, you will know someone who is.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

930 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now