JSP isELIgnored

JSP isELIgnored


Posted in : Java Posted on : May 4, 2012 at 6:35 PM Comments : [ 0 ]

In this tutorial you will learn about the JSP isELIgnored.

JSP isELIgnored

In this tutorial you will learn about the JSP isELIgnored.

In JSP page to evaluate EL expressions isELIgnored attribute should be specified. However, each JSP page is specified to evaluate EL expressions by default. Different web application deployment descriptor version specifies differently the default value for evaluating the EL expression. From the Servlet 2.4 deployment descriptor JSP pages evaluates the EL expressions by default. Default mode of evaluating the EL expressions can be explicitly changed by overriding the page directive isELIgnored attribute in the JSP page or by overriding the tag directive isELIgnored attribute in tag files or by manually to set the element el-ignored=true in the jsp property-group in the web application deployment descriptor. If this attribute is not specified by in any of the above cases EL expressions will be evaluated and if it is specified then the evaluation of EL expressions are depend on the set value.

Example :

Here I am giving a simple example which will demonstrate you about the isELIgnored attribute. In this example at first I have created a JSP file named JspIsELIgnored.jsp where I have specified the isELIgnored attribute as page directive and set the value to true. This means any EL expression will not be executed. But in case when you will not specified it then jsp page has a default value and the EL expressions will be executed. The false value of isELIgnored also specifies that the EL expressions will be executed.

JspIsELIgnored.jsp

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1" isELIgnored="true"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
<title>JSP isELIgnored</title>
</head>
<body>
<h3>Use of JSP isELIgnored Attribute</h3>
<c:set var="str" value="Dev"/>
<c:set var="str1" value="manuals"/>
<c:choose>
<c:when test="${str eq 'Dev'}">
<c:set var="concat" value="${str}${str1}" />
<c:out value="${concat}"></c:out>
</c:when>
<c:otherwise>
<b>"${str}"</b>
</c:otherwise>
</c:choose>

</body>
</html>

Output :

1. When you will execute the above jsp page when the isELIgnored page directive is set to true then the output will be as follows :

2. When you will execute the above jsp page when the isELIgnored page directive is set to false then the output will be as follows :

Download Source Code

Go to Topic «PreviousHomeNext»

Your Comment:


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

 
Tutorial Topics