struts2 ognl 与 jsp2.1 el 的冲突问题
2008-01-23 17:18
405 查看
tomcat6 , jetty6 采用 jsp2.1。
由于 nio 带来的性能提升,tomcat6 不能被忽略。
办法1:
http://www.devzuz.org/blogs/bporter/2006/08/05/1154706744655.html
<ww:select list="#{'default' : 'Maven 2.x Repository', 'legacy' : 'Maven 1.x Repository'}" />
改用-------------------------------------------------------------
<ww:select list="#@java.util.HashMap@{'default' : 'Maven 2.x Repository', 'legacy' : 'Maven 1.x Repository'}" />
这样 jsp2.1 el 就不会有问题了。
办法2: 对于旧的程序,不愿意改了,可以向后兼容
http://today.java.net/lpt/a/272#backwards-compatibility
必须用 Servlet 2.5 XSD.
<web-app xmlns="http://java.sun.com/xml/ns/javaee" version="2.5" 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">
或者在页面中
> <jsp-property-group>
> <url-pattern>*.jsp</url-pattern>
> <el-ignored>true</el-ignored>
> </jsp-property-group>
> </jsp-config>
http://www.mail-archive.com/dev@struts.apache.org/msg28920.html
我现在的疑问
在一个页面中采用两个 el 引擎,是否会对性能造成一定影响?
较小。
[/code]
由于 nio 带来的性能提升,tomcat6 不能被忽略。
办法1:
http://www.devzuz.org/blogs/bporter/2006/08/05/1154706744655.html
<ww:select list="#{'default' : 'Maven 2.x Repository', 'legacy' : 'Maven 1.x Repository'}" />
改用-------------------------------------------------------------
<ww:select list="#@java.util.HashMap@{'default' : 'Maven 2.x Repository', 'legacy' : 'Maven 1.x Repository'}" />
这样 jsp2.1 el 就不会有问题了。
办法2: 对于旧的程序,不愿意改了,可以向后兼容
http://today.java.net/lpt/a/272#backwards-compatibility
必须用 Servlet 2.5 XSD.
<web-app xmlns="http://java.sun.com/xml/ns/javaee" version="2.5" 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">
<jsp-property-group> <deferred-syntax-allowed-as-literal> true </deferred-syntax-allowed-as-literal> </jsp-property-group>
或者在页面中
<%@page language="java" deferredSyntaxAllowedAsLiteral="true" %> 办法3 :不用 jsp2.1 el> <jsp-config>
> <jsp-property-group>
> <url-pattern>*.jsp</url-pattern>
> <el-ignored>true</el-ignored>
> </jsp-property-group>
> </jsp-config>
http://www.mail-archive.com/dev@struts.apache.org/msg28920.html
我现在的疑问
在一个页面中采用两个 el 引擎,是否会对性能造成一定影响?
较小。
[/code]
tomcat6 , jetty6 采用 jsp2.1。
由于 nio 带来的性能提升,tomcat6 不能被忽略。
办法1:(全英文方法)
Jetty 6 (which I use for day to day development) automatically uses JSP 2.1 if you are on JDK 5.0 or above, regardless of what you have specified in web.xml.
This had been biting me on WebWork, because of the introduction of unified EL. The following is no longer valid:
<ww:select list="#{'default' : 'Maven 2.x Repository', 'legacy' : 'Maven 1.x Repository'}" />
But, to escape it with /#{ doesn't work on Tomcat 5 and other 2.0 containers.
The solution?
<ww:select list="#@java.util.HashMap@{'default' : 'Maven 2.x Repository', 'legacy' : 'Maven 1.x Repository'}" />
Thank goodness OGNL had this other syntax for maps that doesn't look like an expression :)
<ww:select list="#{'default' : 'Maven 2.x Repository', 'legacy' : 'Maven 1.x Repository'}" />
改用-------------------------------------------------------------
<ww:select list="#@java.util.HashMap@{'default' : 'Maven 2.x Repository', 'legacy' : 'Maven 1.x Repository'}" />
这样 jsp2.1 el 就不会有问题了。
办法2: 对于旧的程序,不愿意改了,可以向后兼容
http://today.java.net/lpt/a/272#backwards-compatibility
必须用 Servlet 2.5 XSD.
<web-app xmlns="http://java.sun.com/xml/ns/javaee" version="2.5" 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">
<jsp-property-group> <deferred-syntax-allowed-as-literal> true </deferred-syntax-allowed-as-literal> </jsp-property-group>
或者在页面中
<%@page language="java" deferredSyntaxAllowedAsLiteral="true" %> 办法3 :不用 jsp2.1 el> <jsp-config>
> <jsp-property-group>
> <url-pattern>*.jsp</url-pattern>
> <el-ignored>true</el-ignored>
> </jsp-property-group>
> </jsp-config>
相关文章推荐
- struts2 ognl 与 jsp2.1 el 的冲突问题
- webwork ognl的list集合与jsp el 冲突问题解决
- JSTL中EL标签与Struts2中OGNL标签在JSP页面上的区别
- ognl.OgnlContext cannot be cast to java.lang.String错误!可能的原因之一:jsp页面中包含和Struts2中的Context关键字重复从而产生冲突,修
- 关于使用struts2与jsp时,使用prototype.js的$属性与jquery的$冲突问题
- Struts2的ognl与JSP的el表达式取值问题
- struts2 ognl jstl el java代码在jsp页面混用
- JSTL中EL标签与Struts2中OGNL标签在JSP页面上的区别
- JSP 2.1-2.5上用JSTL和EL(表达式语言)的问题
- JSTL中EL标签与Struts2中OGNL标签在JSP页面上的区别
- 解决JSP 开发中,EL标签同名键值取值冲突的问题
- 运行《Struts2 权威指南》 s-if.jsp 的异常引出对 EL 和 OGNL 的思考
- Struts2可以找到action找不到jsp问题
- 【Java EE 学习 69 上】【struts2】【paramsPrepareParamsStack拦截器栈解决model对象和属性赋值冲突问题】
- [JavaEE]Struts2路径问题(如何在jsp页面正确访问struts.xml中的action)
- struts2整合CXF访问路径冲突问题
- Jsp El表达式使用问题javax.el.ELException: Failed to parse the expression
- jsp下拉框取值问题,struts2迭代标签的用法
- struts2返回到JSP页面的html字符串如何在JSP页面上解析成html标签 (ognl表达式)
- Struts2中的ActionContext、OGNL及EL的使用