JSTL Core c:choose Tag

JSTL Core c:choose Tag

The JavaServer Pages Standard Tag Library (JSTL) encapsulates core functionality common to many JSP applications. Instead of mixing tags from numerous vendors in your JSP applications, JSTL allows you to employ a single, standard set of tags. This standardization allows you to deploy your applications on any JSP container supporting JSTL and makes it more likely that the implementation of the tags is optimized.

Below is the syntax to include JSTL Core library in your JSP for JSTL Core c:choose Tag:

<%@ taglib prefix=”c” uri=”http://java.sun.com/jsp/jstl/core” %>

JSTL Core c:choose Tag : Simple conditional tag that establishes a context for mutually exclusive conditional operations, marked by and .The syntax and attributes are as follows with example and ran on server to show you output:

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<title>c:choose Example</title>

<c:set var="value" value="${10+300}"/>
<h2><p>Final value is : <c:out value="${value}"/></p>
    <c:when test="${value < 300}">
       Value is less than 300
    <c:when test="${value > 300}">
        Value is greater than 300
        Whatever we want to print



JSTL Core c:choose Tag output

JSTL Core c:choose Tag

Leave a Reply

Your email address will not be published. Required fields are marked *

I am not Robot *