EL表达式无效?

好久没用过EL表达式了,今天用了竟然不起作用。先说下我的开发环境吧,用的是JDK1.5,Tomcat5.5。最后的解决方案是在JSP页面加<%@ page isELIgnored="false" %> 就OK了。

 

在网上查了一下,问题就出在建Web Project的时候web.xml声明上。 
web.xml声明部分一般分为如下版本的xsd, 
web-app_2_2.xsd 
web-app_2_3.xsd 
web-app_2_4.xsd 
web-app_2_5.xsd  在默认情况下,Servlet 2.3 / JSP 1.2是不支持EL表达式的,而Servlet 2.4 / JSP 2.0支持

 

下面是官方Documention中isELIgnored Attribute的详解: 
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

为了不在每个页面添加<%@ page isELIgnored="false" %>,网上说可以在web.xml中这样配置

<jsp-config>
   <jsp-property-group>
    <url-pattern>*.jsp</url-pattern>
    <el-ignored>false</el-ignored>
   </jsp-property-group>
  </jsp-config>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值