研究分析web.xml影响EL表达式
来源:互联网 发布:3维建模软件 编辑:程序博客网 时间:2024/04/29 07:15
以前用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 :
<?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
<?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
<?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
<?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
本文来自爪式千斤顶:http://www.qizejx.com
- 研究分析web.xml影响EL表达式
- 关于web.xml影响EL表达式
- WEB-el表达式
- WEB: EL表达式
- Web---JSP-EL表达式
- java-web EL表达式
- EL表达式中的 javax.el.PropertyNotFoundException 分析
- WEB: JSTL标签+EL表达式
- Java web----EL(表达式语言)
- Web项目中的EL表达式
- EL表达式不可用分析
- Web.xml V2.5中打开EL表达式支持的方法
- 关于el表达式在web.xml用2.5版本的xsd不起作用的处理方法
- 在web.xml文件中使用EL表达式配置变量例子
- jsp web JavaBean MVC 架构 EL表达式 EL函数 JSTL
- EL表达式在web开发中的设置
- java web之EL表达式的使用
- Java Web----EL(表达式语言)详解
- 有关java中采用List 分页技术问题
- Spring,struts,hibernate常见的面试笔试题汇总(2)
- Spring,struts,hibernate常见的面试笔试题汇总(3)
- 创建静态横切的语法和动态横切有很大的不同
- 如何获得积分
- 研究分析web.xml影响EL表达式
- 1
- 安装S60开发包
- android xml布局中TextView居中方法
- visual studio 2008 试用版评估期已结束的解决方法
- B3log Solo 0.1.0-preview2 发布了!
- 面试——海量数据处理专题
- 2010年9月26日微软笔试题
- 通过WMI获取系统IP