JSP Tutorials - Herong's Tutorial Examples - v5.11, by Herong Yang
c:choose Action Tag
This section describes the c:choose action tag in the JSTL Core library. c:choose allows you to specify multiple sections of JSP codes and let the JSP container to process one of them based on specified conditions.
The <c:choose> action tag allows you to specify multiple sections of JSP codes with different conditions for different sections. The JSP container will process a JSP code section who's condition is evaluated to "true". Syntax of the <c:choose> action tag is:
<c:choose> <c:when test="condition"> body </c:when> <c:when test="condition"> body </c:when> ... <c:otherwise> body </c:otherwise> </c:choose>
Note that:
The <c:choose> action tag behaves like a Java "if ... then ... else" statement.
Table of Contents
JSP (JavaServer Pages) Overview
Tomcat Installation on Windows Systems
Syntax of JSP Pages and JSP Documents
JavaBean Objects and "useBean" Action Elements
Managing HTTP Response Header Lines
Non-ASCII Characters Support in JSP Pages
Overview of JSTL (JSP Standard Tag Libraries)
c:out Action Tag with EL Expressions
Example - Dumping EL Implicit Objects
Example - Calculating Prime Numbers
Multiple Tags Working Together
Using Tomcat on CentOS Systems
Connecting to SQL Server from Servlet