Java/JSTL/Condition
Using Choose,Otherwise and When
<source lang="java">
<%@ taglib uri="http://java.sun.ru/jstl/core" prefix="c" %> <html>
<head> <title>Using Choose,Otherwise and When</title> </head> <body> <c:if test="${pageContext.request.method=="POST"}">You entered: <c:choose> <c:when test="${param.enter=="1"}">One
</c:when> <c:when test="${param.enter=="2"}">Two
</c:when> <c:when test="${param.enter=="3"}">Three
</c:when> <c:when test="${param.enter=="4"}">Four
</c:when> <c:when test="${param.enter=="5"}">Five
</c:when> <c:otherwise> <c:out value="${param.enter}" />
</c:otherwise> </c:choose> </c:if> <form method="post">Enter a number between 1 and 5: <input type="text" name="enter" /> <input type="submit" value="Accept" />
</form> </body>
</html>
</source>