首先復制一下代碼到一個新建的JSP中。。。
<%@ page contentType="text/html;charset=UTF-8" isELIgnored="false"%>
<%@ taglib uri="http://java./jsp/jstl/core" prefix="c"%> <HTML> <% request.setAttribute("test", "test-----------------------"); %> <BODY> this is a page for test el...<br/> data:${test} </BODY> </HTML> 訪問這個JSP。。
如果能出現(xiàn)如下內(nèi)容則說明el表達式是沒問題的。。
this is a page for test el...
data:test----------------------- 一般都會沒什么問題的,另使用EL應該注意的一個問題。。。
查看web.xml中的
<web-app version="2.5" xmlns="http://java./xml/ns/javaee"
xmlns:xsi="http://www./2001/XMLSchema-instance" xsi:schemaLocation="http://java./xml/ns/javaee http://java./xml/ns/javaee/web-app_2_5.xsd"> 如果web-app為2.4或以上的話isELIgnored默認為false,以前的版本默認為true,需手動在頁面中加入isELIgnored="false"。。。
官方文檔
The isELIgnored Attribute
• Format – <%@ page isELIgnored="false" %> – <%@ page isELIgnored="true" %> 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 |
|
來自: soft_xiang > 《Java》