Choose When Statement : Choose « JSTL « Java Tutorial

<%@ taglib uri="" prefix="c" %>
    <title>Using Choose,Otherwise and When</title>

    <c:if test="${pageContext.request.method=='POST'}">You entered:
      <c:when test="${param.enter=='1'}">One
      <br />

      <c:when test="${param.enter=='2'}">Two
      <br />

      <c:when test="${param.enter=='3'}">Three
      <br />

      <c:when test="${param.enter=='4'}">Four
      <br />

      <c:when test="${param.enter=='5'}">Five
      <br />

        <c:out value="${param.enter}" />

        <br />

    <form method="post">Enter a number between 1 and 5:
    <input type="text" name="enter" />

    <input type="submit" value="Accept" />

    <br />
  Download: 1,226 k)

24.5.1.Tag Examples - choose
24.5.2.Combine If Chooser to Report Exception
24.5.3.Choose XML Data with Comparision
24.5.4.Choose When Statement
24.5.5.Choose When and Otherwise