---
title: "jsp页面突然不支持EL的问题"
author: "spiritfrog"
date: "2010-07-12T16:11:23Z"
tags: ["JSP", "Java", "SUN", "Web", "XML"]
categories: ["编程语言"]
slug: "jsp-el"
draft: false
lastmod: "2010-07-12T16:11:23Z"
id: 710795
url: "https://spiritfrog.iteye.com/blog/710795"
---

转自[http://www.iteye.com/topic/155354?page=2](http://www.iteye.com/topic/155354?page=2)

 

问题就出在建Web Project的时候web.xml声明上。   
web.xml声明部分一般分为如下版本的xsd,   
web-app\_2\_2.xsd   
web-app\_2\_3.xsd   
web-app\_2\_4.xsd   
web-app\_2\_5.xsd 

更详细的列出各版本web.xml声明部分吧，如下：   
web-app\_2\_2.xsd

Java代码 

1. &lt;?xml version="1.0" encoding="UTF-8"?&gt;
2. &lt;!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/dtd/web-app\_2\_2.dtd"&gt;

web-app\_2\_3.xsd 

Java代码 

1. &lt;?xml version="1.0" encoding="UTF-8"?&gt;
2. &lt;!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app\_2\_3.dtd"&gt;

web-app\_2\_4.xsd 

Java代码 

1. &lt;?xml version="1.0" encoding="UTF-8"?&gt;
2. &lt;web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee   http://java.sun.com/xml/ns/j2ee/web-app\_2\_4.xsd"&gt;

web-app\_2\_5.xsd 

Java代码 

1. &lt;?xml version="1.0" encoding="UTF-8"?&gt;
2. &lt;web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.5" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee   http://java.sun.com/xml/ns/javaee/web-app\_2\_5.xsd"&gt;

确定web.xml里的xsd版本之后一定要在JSP的声明(&lt;%@page %&gt;)部分加一行，如下：   
&lt;%@ page isELIgnored="false" %&gt;   
这样设为false才能解析EL表达式。   
经过各版本的test之后....   
注意!! 其中servlets 2.4(我没记错的话JSP 2.0出来之后的第一个版本)，这个版本的isELIgnored默认设置为false。所以使用web.xml里用web-app\_2\_4.xsd声明的时候在JSP页面不用特意声明。 

下面是官方Documention中isELIgnored Attribute的详解：   
**The isELIgnored Attribute**   
**• Format**   
– &lt;%@ page isELIgnored="false" %&gt;   
– &lt;%@ page isELIgnored="true" %&gt;   
**Purpose**   
– To control whether the JSP 2.0 Expression Language   
(EL) is ignored (true) or evaluated normally (false).   
**• Notes**   
– If your web.xml specifies servlets 2.3 (corresponding to   
JSP 1.2) or earlier, the default is true   
• But it is still legal to change the default—you are permitted   
to use this attribute in a JSP-2.0-compliant server   
regardless of the web.xml version.   
– If your web.xml specifies servlets 2.4 (corresponding to   
JSP 2.0) or earlier, the default is false