首先复制一下代码到一个新建的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。。
如果能出现如下内容则说明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》