English Title:Weblogic 10 leaves the problem of JSP El and Ognl and means of settlement
在使用Webwork或Struts2标签写JSP时,经常会用到如下写法: <ww:radio name="gender" list='#{"1":"Male", "2":"FeMale"}' /> <ww:select name="yes" list='#{"1":"YES","2":"NO"}' /> 这是ognl的写法,list里的表达式将解释成成一个Map,实际上是一个LinkedHashMap。 ? 这种写法在Tomat下部署是没有任何问题的,但部署到Weblogic 10下问题就来了,这里web.xml的version声明为2.4,编译JSP时报表达式错误。如果声明为2.3是不会报错的,因为servlet 2.3(即jsp 1.2)是不支持EL的,使用Weblogic 9同样也不会报错。据此可以推测原因为编译JSP时Weblogic? JSP编译器将OGNL的表达式误认为是EL表达式。 ? ?解决办法: 1、禁用EL。在web.xml上加上 <jsp-config> <jsp-property-group> <url-pattern>*.jsp</url-pattern> <el-ignored>true</el-ignored> </jsp-property-group> </jsp-config> ?2、更改web.xml的version为2.3。 ?3、因为大量页面用到EL,如${someValue},所以1和2基本行不通的,所以从OGNL的表达式入手,最终写成 list='#@java.util.LinkedHashMap@{"1":"Male","2":"FeMale"}'?, 显式指定使用LinkedHashMap来构建Map。问题解决。
==========English==========
When use Webwork or Struts2 label write JSP, classics regular meeting uses a method: <ww:rAdio Name="gender" List='#{"1" :" Male" , "2" :" FeMale"}' /><ww:sElect Name="yes" List='#{"1" :" YES" , "2" :" NO"}' />This is Ognl write a law, the expression in List becomes the explanation a Map, it is a LinkedHashMap actually. ? This kind writes a law to issue deploy in Tomat do not have any problems, but deploy came to the problem below Weblogic 10, the Version statement of Web.xml is here 2.4, compile mistake of JSP times expression. If statement is 2.3 be to won't sign up for a fault, because of Servlet 2.3(namely Jsp 1.2) does not support EL, use Weblogic 9 also won't sign up for a fault likewise. Can you figure the reason is the Weblogic when compiling JSP accordingly? JSP is compiled implement consider as the expression of OGNL EL expression by accident. ? ? Settle way: 1, ban with EL. <jsp-config is added on Web.xml><jsp-property-group><url-pattern>*.jsp</url-pattern><el-ignored>true</el-ignored></jsp-property-group></jsp-config>? 2, the Version that changes Web.xml is 2.3. ? 3, use EL because of a large number of pages, be like ${someValue} , so 1 and 2 won't do basically, so the expression proceed with from OGNL, write finally into List='#@java.util.LinkedHashMap@{"1" :" Male" , "2" :" FeMale"}' ? , explicit appoint use LinkedHashMap to come compose builds Map. Ask the problem is solved.
|