<web-app xmlns:xsi=….. version=”3.0”>
And EL expressions are ignored if the Servlet version is 2.3 or lower:<web-app xmlns:xsi=….. version=”2.3”>
Today the latest version of Servlet is 3.0, so it’s likely that every Java web application has EL evaluation enabled by default.<%@ page isELIgnored="true" %>
For example, following JSP page disables EL evaluation:<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"
isELIgnored="true"
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Deactivate EL Demo</title>
</head>
<body>
EL expression result is: ${2 * 4 + 3 * 4}
</body>
</html> Output:EL expression result is: ${2 * 4 + 3 * 4}
<%@ page isELIgnored="false" %>
Output of the above JSP page:EL expression result is: 20
<jsp-config> <jsp-property-group> <url-pattern>*.jsp</url-pattern> <el-ignored>true</el-ignored> </jsp-property-group> </jsp-config>And to activate EL evaluation for all .jsp pages:
<jsp-config> <jsp-property-group> <url-pattern>*.jsp</url-pattern> <el-ignored>false</el-ignored> </jsp-property-group> </jsp-config>What if a JSP page specifies attribute isELIgnored already? Then the isELIgnored attribute will override setting in the web.xml file.
Nam Ha Minh is certified Java programmer (SCJP and SCWCD). He began programming with Java back in the days of Java 1.4 and has been passionate about it ever since. You can connect with him on Facebook and watch his Java videos on YouTube.