分享

解决EL表达式不能用的几种方法

 soft_xiang 2010-12-29
首先复制一下代码到一个新建的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为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

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多