JSP页面EL表达式无效的问题

关于EL的官方说明:http://docs.oracle.com/javaee/1.4/tutorial/doc/JSPIntro7.html

摘抄一小段:

Deactivating Expression Evaluation

The default value varies depending on the version of the web application deployment descriptor. The default mode for JSP pages delivered using a Servlet 2.3 or earlier descriptor is to ignore EL expressions; this provides backward compatibility. The default mode for JSP pages delivered with a Servlet 2.4 descriptor is to evaluate EL expressions; this automatically provides the default that most applications want. You can also deactivate EL expression evaluation for a group of JSP pages (see Deactivating EL Expression Evaluation).

大体意思是servlet2.3和2.3以前的servlet是默认是关闭EL的,2.4默认是开启的。

解决方案:

1.<%@ page isELIgnored ="true|false" %> false是开启

 

2.web.xml(servlet 2.4或2.5等等都行):

<?xml version="1.0" encoding="UTF-8"?> 

<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">

</web-app>

 

 

posted on 2013-05-09 13:02  lovebeauty  阅读(863)  评论(0编辑  收藏  举报

导航