??xml version="1.0" encoding="utf-8" standalone="yes"?> Weblogic 10下JSP el与ognl的问题与解决Ҏ admin发布?010-05-06 10:17 | 142ơ阅?/font> English Title:Weblogic 10 leaves the problem of JSP El and Ognl and means of settlement
2. 减少使用Ognl表达式,最好用FreeMaker代替JSP
3. 关闭logging和devMode
4. Struts.xml中删除不需要的拦截?
]]>
http://www.pjprimer.com/view-24083-1.html
在用Webwork或Struts2标签写JSPӞl常会用到如下写法: <ww:radio name="gender" list='#{"1":"Male", "2":"FeMale"}' /> <ww:select name="yes" list='#{"1":"YES","2":"NO"}' /> q是ognl的写法,list里的表达式将解释成成一个MapQ实际上是一个LinkedHashMap?? q种写法在Tomat下部|是没有M问题的,但部|到Weblogic 10下问题就来了Q这里web.xml的version声明?.4Q编译JSP时报表达式错误。如果声明ؓ2.3是不会报错的Q因为servlet 2.3(即jsp 1.2)是不支持EL的,使用Weblogic 9同样也不会报错。据此可以推原因ؓ~译JSP时Weblogic? JSP~译器将OGNL的表辑ּ误认为是EL表达式?? ?解决办法Q?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?.3??3、因为大量页面用到ELQ如${someValue}Q所??基本行不通的Q所以从OGNL的表辑ּ入手Q最l写?list='#@java.util.LinkedHashMap@{"1":"Male","2":"FeMale"}'?, 昑ּ指定使用LinkedHashMap来构建Map。问题解冟?br />
==========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.
]]>
]]>
1.一个value stack本质上是一个List;
2.在栈中调用[n]返回一个从位置n开始的子栈;
对于2举个例子说明。假定Value Stack包含了[model,action,others]Q那?/p>
[0] --- q回 [model,action,others]Q?
[1] --- q回 [action,others]Q?
[2] --- q回 [others];
现在开始介ls:iterator的一些用。以下代码片D均在开发环境eclipse3.4 wtp、tomcat5.5、jdk5上用struts2.1.6试通过?/p>
1) 、访?days
defined List<String> days ["Monday","Thursday","Friday","Sunday"]
view plaincopy to clipboardprint?
<s:iterator value="days"><s:property /></s:iterator>
<s:iterator value="days"><s:property /></s:iterator>
2) 、?top 关键字?qo掉Monday)
defined List<String> days ["Monday","Thursday","Friday","Sunday"]
view plaincopy to clipboardprint?
<s:iterator value="days">
<s:if test="top!='Monday'">
<s:property />
</s:if>
</s:iterator>
<s:iterator value="days">
<s:if test="top!='Monday'">
<s:property />
</s:if>
</s:iterator>
top 指代当前q代元素Q可以ؓ对象Q?
q里的top可用[0].top替代Q但不能使用[0]。[0]代表整个栈对象。如果单U调用[0]会调用其toString()Ҏ输出对象信息Q?/p>
3)、?last / first 关键字?/strong>
defined String[][] aTs = { { "一", "?, "?, "? },{ "一一", "二二", "三三", "四四"} };
view plaincopy to clipboardprint?
<!--遍历二维数组QThe trick here is to use 'top' as the value for the inner iterator-->
<s:iterator value="aTs" status="of">
<s:if test="#of.last"><br/></s:if>
<s:iterator value="top">
<!--亦可用[0].top替代。如果单U用[0],则会同时打印该处栈对象信?->
<s:property />
</s:iterator>
</s:iterator>
<!--遍历二维数组QThe trick here is to use 'top' as the value for the inner iterator-->
<s:iterator value="aTs" status="of">
<s:if test="#of.last"><br/></s:if>
<s:iterator value="top">
<!--亦可用[0].top替代。如果单U用[0],则会同时打印该处栈对象信?->
<s:property />
</s:iterator>
</s:iterator>
iterator 标签中的status属性代表当前P代的位置Q?
#of.last用于判断当前是否跌到的最后一个元素;
lastq回一个booleancd;
first q回一个booleancd;
4)、?odd / even 关键?/strong>
下面的例子要实现每行输出颜色不同的效果?/p>
defined List<String> days ["Monday","Thursday","Friday","Sunday"]
view plaincopy to clipboardprint?
<!--奇数行显CZؓU色,偶数行显CZؓl色-->
<s:iterator value="days" status="offset">
<s:else>
<s:if test="#offset.odd==true">
<li style="color: red" mce_style="color: red"><s:property /></li>
</s:if>
<s:else>
<li><s:property /></li>
</s:else>
</s:else>
</s:iterator>
<!--奇数行显CZؓU色,偶数行显CZؓl色-->
<s:iterator value="days" status="offset">
<s:else>
<s:if test="#offset.odd==true">
<li style="color: red" mce_style="color: red"><s:property /></li>
</s:if>
<s:else>
<li><s:property /></li>
</s:else>
</s:else>
</s:iterator>
odd关键字用来判断当前P代位|是否ؓ奇数行。oddq回booleancd;
evne关键字用来判断当前P代位|是否ؓ偶数行。evenq回booleancd
5)、ȝ下,当声明iterator的status属性时Q通过#statusName.method 可以使用以下Ҏ:
even : boolean - 如果当前q代位置是偶数返回true
odd : boolean - 如果当前q代位置是奇数返回true
count : int - q回当前q代位置的计??开?
index : int - q回当前q代位置的编??开?
first : boolean - 如果当前q代位置是第一位时q回true
last : boolean - 如果当前q代位置是最后一位时q回true
modulus(operand : int) : int - q回当前计数(?开?与指定操作数的模?
6)、最后再来看下在iterator中调用value stack的用法?/strong>
假定countries是一个List对象Q每一个country有一个name属性和一个citys List对象Qƈ且每一个city也有一个name属?。那么我们想要在q代cities是访问countries的name属性就的用如下方式Q?/p>
view plaincopy to clipboardprint?
<s:iterator value="countries">
<s:iterator value="cities">
<s:property value="name"/>, <s:property value="[1].name"/><br>
</s:iterator>
</s:iterator>
<s:iterator value="countries">
<s:iterator value="cities">
<s:property value="name"/>, <s:property value="[1].name"/><br>
</s:iterator>
</s:iterator>
q里?<ww:property value="name"/>取的是ctiy.name;<ww:property value="[1].name"/>取得是country.name
<ww:property value="[1].name"/> {h?<ww:property value="[1].top.name"/>
we refer to a specific position on the stack: '[1]'. The top of the stack, position 0, contains the current city, pushed on by the inner iterator; position 1 contains the current country, pushed there by the outer iterator.(city处于当前栈,即top或者[0],而[1]指明了外层iterator对象Q即country)
'[n]'标记引用开始位|ؓn的子栈(sub-stackQ,而不仅仅是位|n处的对象。因?[0]'代表整个栈,?[1]'是除top对象外所有的栈元素?
转蝲出处Qhttp://blog.csdn.net/oxcow/archive/2009/09/03/4516283.aspx
我们在javascript中可以通过以下方式d和赋?/p>
以上代码Q取出time1中的|赋给time2
Getting and getting the datetimepicker value, from JavaScript:
Publish topic when value changes: