JSTL Core c:otherwise Tag

JSTL Core c:otherwise 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:otherwise Tag :

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

JSTL Core c:otherwise Tag :Subtag of that follows tags and runs only if all of the prior conditions evaluated to ‘false’.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:otherwise Example</title>

<c:set var="value" value="${14*2}"/>
<h2><p>Value is : <c:out value="${value}"/></p>
    <c:when test="${value > 30}">
      Value is less than 30
        Otherwise whatever we like...



JSTL Core c:otherwise Tag output:

JSTL Core c:otherwise Tag

Leave a Reply

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

I am not Robot *