代码改变世界

EL表达<%@page isELIgnored="false"%>问题

2016-08-08 19:45  faunjoe88  阅读(1081)  评论(0编辑  收藏  举报

上网查找资料后得知:主要原因是EL表达式无法被解析到.
其实从后台取值并传值到前台来根本就没有错,而前台JSP页面EL表达式无效,解析不到EL表达式,引起的原因是web.xml中:
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

注意里面的web-app_2_5.xsd,就是这个引起的

 

升级为:


1 <?xml version="1.0" encoding="UTF-8"?>
2 <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3          xmlns="http://java.sun.com/xml/ns/javaee"
4          xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
5          id="WebApp_ID" version="3.0">

在不改变web.xml2.5版本的情况下解决办法是:在jsp页面头加:<%@page isELIgnored="false"%>   问题得以解决。

还有就是:<%@page isELIgnored="false"%>的优先级要高于web.xml中的设置,所以在JSP中的设置会盖掉web.xml中的设置.