- 浏览: 56121 次
- 性别:
- 来自: 南京
最新评论
-
Azureym:
哥们.你的httpclient呢?
httpclient读取inputstream流 -
leo133845920:
liuborama 写道用自己写的东西是比较会有成就感,我也喜 ...
处女贴...递归遍历文件夹删除文件 -
liuborama:
用自己写的东西是比较会有成就感,我也喜欢。无意冒犯,不过单独就 ...
处女贴...递归遍历文件夹删除文件
以前用WSAD wizard做的,都可以在JSP页面中解析到EL表达式,当然前提是JSP2.0的情况下。
今天遇到了一个莫名其妙的问题。刚下载Eclipse3.3+MyEclipse6.0体验的过程中,遇上了解析不到EL表达式的问题。经过好几个小时的琢磨终于发现了,给大家share一下:
问题就出在建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
更详细的列出各版本web.xml声明部分吧,如下:
web-app_2_2.xsd
Java代码 < type="application/x-shockwave-flash" width="14" height="15" src="http://gimgen1026.iteye.com/javascripts/syntaxhighlighter/clipboard_new.swf" pluginspage="http://www.macromedia.com/go/getflashplayer" allowscriptaccess="always" quality="high" flashvars="clipboard=%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%3F%3E%0A%3C!DOCTYPE%20web-app%20PUBLIC%20%22-%2F%2FSun%20Microsystems%2C%20Inc.%2F%2FDTD%20Web%20Application%202.2%2F%2FEN%22%20%22http%3A%2F%2Fjava.sun.com%2Fdtd%2Fweb-app_2_2.dtd%22%3E">
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/dtd/web-app_2_2.dtd">
web-app_2_3.xsd
Java代码 < type="application/x-shockwave-flash" width="14" height="15" src="http://gimgen1026.iteye.com/javascripts/syntaxhighlighter/clipboard_new.swf" pluginspage="http://www.macromedia.com/go/getflashplayer" allowscriptaccess="always" quality="high" flashvars="clipboard=%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%3F%3E%0A%3C!DOCTYPE%20web-app%20PUBLIC%20%22-%2F%2FSun%20Microsystems%2C%20Inc.%2F%2FDTD%20Web%20Application%202.3%2F%2FEN%22%20%22http%3A%2F%2Fjava.sun.com%2Fdtd%2Fweb-app_2_3.dtd%22%3E">
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
web-app_2_4.xsd
Java代码 < type="application/x-shockwave-flash" width="14" height="15" src="http://gimgen1026.iteye.com/javascripts/syntaxhighlighter/clipboard_new.swf" pluginspage="http://www.macromedia.com/go/getflashplayer" allowscriptaccess="always" quality="high" flashvars="clipboard=%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%3F%3E%0A%3Cweb-app%20xmlns%3D%22http%3A%2F%2Fjava.sun.com%2Fxml%2Fns%2Fj2ee%22%20xmlns%3Axsi%3D%22http%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema-instance%22%20version%3D%222.4%22%20xsi%3AschemaLocation%3D%22http%3A%2F%2Fjava.sun.com%2Fxml%2Fns%2Fj2ee%20%20%20http%3A%2F%2Fjava.sun.com%2Fxml%2Fns%2Fj2ee%2Fweb-app_2_4.xsd%22%3E">
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
web-app_2_5.xsd
Java代码 < type="application/x-shockwave-flash" width="14" height="15" src="http://gimgen1026.iteye.com/javascripts/syntaxhighlighter/clipboard_new.swf" pluginspage="http://www.macromedia.com/go/getflashplayer" allowscriptaccess="always" quality="high" flashvars="clipboard=%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%3F%3E%0A%3Cweb-app%20xmlns%3D%22http%3A%2F%2Fjava.sun.com%2Fxml%2Fns%2Fjavaee%22%20xmlns%3Axsi%3D%22http%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema-instance%22%20version%3D%222.5%22%20xsi%3AschemaLocation%3D%22http%3A%2F%2Fjava.sun.com%2Fxml%2Fns%2Fjavaee%20%20%20http%3A%2F%2Fjava.sun.com%2Fxml%2Fns%2Fjavaee%2Fweb-app_2_5.xsd%22%3E">
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.5" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
确定web.xml里的xsd版本之后一定要在JSP的声明(<%@page %>)部分加一行,如下:
<%@ page isELIgnored="false" %>
这样设为false才能解析EL表达式。
经过各版本的test之后....
注意!! 其中servlets 2.4(我没记错的话JSP 2.0出来之后的第一个版本),这个版本的isELIgnored默认设置为false。所以使用web.xml里用web-app_2_4.xsd声明的时候在JSP页面不用特意声明。
下面是官方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
-------------------------------------------------以上为google出来的结果------------------------------------
只有Servlet2.4版本默认支持EL,如果在MyEclipse新建web项目时,选择Java EE5.0的时候是用Servlet2.5的。它默认是不支持EL.要在页面声明<%@ page isELIgnored="false" %> 方有效,有谁知道在哪个配置文件中一次性声明,就不用每个页面都要声明的话,哪位能告诉我呢?谢谢!
今天遇到了一个莫名其妙的问题。刚下载Eclipse3.3+MyEclipse6.0体验的过程中,遇上了解析不到EL表达式的问题。经过好几个小时的琢磨终于发现了,给大家share一下:
问题就出在建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
更详细的列出各版本web.xml声明部分吧,如下:
web-app_2_2.xsd
Java代码 < type="application/x-shockwave-flash" width="14" height="15" src="http://gimgen1026.iteye.com/javascripts/syntaxhighlighter/clipboard_new.swf" pluginspage="http://www.macromedia.com/go/getflashplayer" allowscriptaccess="always" quality="high" flashvars="clipboard=%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%3F%3E%0A%3C!DOCTYPE%20web-app%20PUBLIC%20%22-%2F%2FSun%20Microsystems%2C%20Inc.%2F%2FDTD%20Web%20Application%202.2%2F%2FEN%22%20%22http%3A%2F%2Fjava.sun.com%2Fdtd%2Fweb-app_2_2.dtd%22%3E">
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/dtd/web-app_2_2.dtd">
web-app_2_3.xsd
Java代码 < type="application/x-shockwave-flash" width="14" height="15" src="http://gimgen1026.iteye.com/javascripts/syntaxhighlighter/clipboard_new.swf" pluginspage="http://www.macromedia.com/go/getflashplayer" allowscriptaccess="always" quality="high" flashvars="clipboard=%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%3F%3E%0A%3C!DOCTYPE%20web-app%20PUBLIC%20%22-%2F%2FSun%20Microsystems%2C%20Inc.%2F%2FDTD%20Web%20Application%202.3%2F%2FEN%22%20%22http%3A%2F%2Fjava.sun.com%2Fdtd%2Fweb-app_2_3.dtd%22%3E">
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
web-app_2_4.xsd
Java代码 < type="application/x-shockwave-flash" width="14" height="15" src="http://gimgen1026.iteye.com/javascripts/syntaxhighlighter/clipboard_new.swf" pluginspage="http://www.macromedia.com/go/getflashplayer" allowscriptaccess="always" quality="high" flashvars="clipboard=%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%3F%3E%0A%3Cweb-app%20xmlns%3D%22http%3A%2F%2Fjava.sun.com%2Fxml%2Fns%2Fj2ee%22%20xmlns%3Axsi%3D%22http%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema-instance%22%20version%3D%222.4%22%20xsi%3AschemaLocation%3D%22http%3A%2F%2Fjava.sun.com%2Fxml%2Fns%2Fj2ee%20%20%20http%3A%2F%2Fjava.sun.com%2Fxml%2Fns%2Fj2ee%2Fweb-app_2_4.xsd%22%3E">
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
web-app_2_5.xsd
Java代码 < type="application/x-shockwave-flash" width="14" height="15" src="http://gimgen1026.iteye.com/javascripts/syntaxhighlighter/clipboard_new.swf" pluginspage="http://www.macromedia.com/go/getflashplayer" allowscriptaccess="always" quality="high" flashvars="clipboard=%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%3F%3E%0A%3Cweb-app%20xmlns%3D%22http%3A%2F%2Fjava.sun.com%2Fxml%2Fns%2Fjavaee%22%20xmlns%3Axsi%3D%22http%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema-instance%22%20version%3D%222.5%22%20xsi%3AschemaLocation%3D%22http%3A%2F%2Fjava.sun.com%2Fxml%2Fns%2Fjavaee%20%20%20http%3A%2F%2Fjava.sun.com%2Fxml%2Fns%2Fjavaee%2Fweb-app_2_5.xsd%22%3E">
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.5" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
确定web.xml里的xsd版本之后一定要在JSP的声明(<%@page %>)部分加一行,如下:
<%@ page isELIgnored="false" %>
这样设为false才能解析EL表达式。
经过各版本的test之后....
注意!! 其中servlets 2.4(我没记错的话JSP 2.0出来之后的第一个版本),这个版本的isELIgnored默认设置为false。所以使用web.xml里用web-app_2_4.xsd声明的时候在JSP页面不用特意声明。
下面是官方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
-------------------------------------------------以上为google出来的结果------------------------------------
只有Servlet2.4版本默认支持EL,如果在MyEclipse新建web项目时,选择Java EE5.0的时候是用Servlet2.5的。它默认是不支持EL.要在页面声明<%@ page isELIgnored="false" %> 方有效,有谁知道在哪个配置文件中一次性声明,就不用每个页面都要声明的话,哪位能告诉我呢?谢谢!
发表评论
-
jetty 打包的问题
2011-05-10 20:52 1332WARN::failed struts2: Unable to ... -
session.flush与transaction.commit
2011-04-27 09:34 932以session的save方法为例来看一个简单、完整的事务流程 ... -
java环境变量
2011-04-10 12:26 769【系统变量】列表中,添加“JAVA_HOME”, 在变量值里面 ... -
Content-Encoding: deflate
2011-04-08 14:27 967new InflaterInputStream(is, new ... -
singleton实例
2011-03-30 17:02 811public class Singleton { p ... -
java关键字Transient与volatile
2011-03-28 10:57 905Volatile修饰的成员变量在每次被线程访问时,都强迫从共享 ... -
ARRAYLIST VECTOR LINKEDLIST 区别与用法
2011-03-28 10:45 639最近用到了,所以依然 ... -
js关闭窗口
2011-02-28 14:31 711<input type="button&quo ... -
xpath不完全整理版
2011-02-17 09:44 710Xpath 多条件实例: //cell[data[text( ... -
httpclient读取inputstream流
2011-02-10 10:35 4660public static String getStri ... -
log4j配置
2011-01-30 17:26 658Log4J的配置文件(Configuration File)就 ... -
FusionCharts的参数使用
2011-01-18 20:21 914今天刚把调用FusionCharts的代码封装好 还测试了一 ... -
启动Tomcat6.x时manager does not exist or is not a readable directory
2011-01-10 13:55 1023前几天重新安装了Tomcat6,安装完Tomcat6后在wep ... -
List转成Array
2010-12-07 10:37 846List<Part> list = new Arr ... -
java随机发牌
2010-10-20 09:55 965import java.util.Random; publi ... -
字符编码笔记:ASCII,Unicode和UTF-8
2010-09-03 11:15 672今天中午,我突然想搞 ... -
JSON中,java.lang.NoClassDefFoundError: net/sf/ezmorph/Morpher问题解决
2010-09-02 17:34 3650使用JSON,在SERVLET或者STRUTS的ACTION中 ... -
简单的读写xml
2010-08-02 15:45 800public synchronized static Lis ... -
临时写的敏感度分析
2010-05-27 20:34 519public class Temp{ public ... -
获取applicationContext的几个类
2010-05-13 14:36 12341, ApplicationContext ac = new ...
相关推荐
java中JSP和el表达式的隐含对象,能够让你对对jsp的更熟悉
el表达式,jsp.el表达式,页面el表达式,el表达式注释 el表达式的解释,el表达式的应用,java el表达式
JSP-EL表达式 一些简单的介绍 希望对大家有所帮助吧
jspEL表达式 jspEL表达式 jspEL表达式 jspEL表达式
JSP中EL表达式,主要介绍EL的详细用法,熟练掌握EL知识。
下面小编就为大家带来一篇jsp页面中EL表达式被当成字符串处理不显示值问题的解决方法。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧
jsp el表达式详解
关于jsp中EL(Expression Language)表达式的相关简介
在JSP页面用EL表达式调用一些函数,可以减少小脚本的出现
JSP与EL详解
JSP-EL表达式
JAVAWEB项目, 在JSP页面不使用任何java代码,使用servlet和EL表达式,这里是EL所需的两个jar包
JavaWeb-11 JSP&EL表达式
例如,EL 表达式可以使用 ${pageScope.objectName} 访问一个 JSP 中页面范围的对象,还可以使用 ${pageScope.objectName.attributeName} 访问对象的属性。 requestScope 将请求范围的变量名称映射到其值。该对象...
javaweb开发中关于jsp 的el表达式比较全非常好用,非常适用于初学者
EL表达式的概念,详细介绍了EL表达式相关使用方法以及注意要点
JSP中的EL表达式介绍.doc 详细介绍EL表达式的应用
Servlet+MySql+Web(HTML+CSS+JSP技术+EL表达式)通过IDEA来实现数据库的增删改查(crud))-附件资源
NULL 博文链接:https://li1314aishui.iteye.com/blog/1314537
jsp el 表达式语言文档