首先復(fù)制一下代碼到一個(gè)新建的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> 訪問這個(gè)JSP。。
如果能出現(xiàn)如下內(nèi)容則說明el表達(dá)式是沒問題的。。
this is a page for test el...
data:test----------------------- 一般都會(huì)沒什么問題的,另使用EL應(yīng)該注意的一個(gè)問題。。。
查看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默認(rèn)為false,以前的版本默認(rèn)為true,需手動(dòng)在頁面中加入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 |
|