關於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>