You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Rich_m <rm...@caris.com> on 2009/02/10 16:24:55 UTC
Re: Attribute OGNL evaluation issue on struts tag in tag file
I'm having the same problem, posted it on the opensymphony ognl forum here:
http://forums.opensymphony.com/thread.jspa?messageID=625477
QZ wrote:
>
> We were using JSP EL expression to evaluate parameter value passed from a
> custom tag to struts tag defined in that custom tag file. After we
> upgraded Struts from 2.0.9 to 2.0.14, we had to modify struts tag defined
> in our tag file since JSP EL expression is not allowed any more in struts
> tag because of changes from WW-2107.
>
> One problem is that, some OGNL expression parameter value can not be
> treated as expression any more
> when the paratemeters reach Struts tag. The value (such as "top") is
> always treated as string literal "'top'"
> in free marker therefore never been evaluated (returns "top" string as
> result back).
>
> Here is an example:
>
> We pass "top" as listKey attribute value from customed tag defined in
> select.tag.
> If we don't check (if listkey=='top'), it would pass it as string literal
> "'top'" to free marker
> instead of "top" which get evaluated.
>
> WAS:
>
> <s:select name="${name}" label="%{getText('${label}')}" list="${list}"
> listKey="${listKey}" listValue="${listValue}" headerValue="${headerValue}"
> headerKey="${headerKey}" size="${size}"
> emptyOption="${emptyOption}" tooltip="%{getTex….
>
>
> NOW:
>
> <c:if test="${list != null}"> <s:set name="list"
> value="%{getList(#attr.list)}"/></c:if>
> <s:select name="%{#attr.name}" label="%{getText(#attr.label)}"
> list="%{#attr.list}" listKey="#attr.listKey
> =='top'?top:getString(#attr.listKey)"
> listValue="getString(#attr.listValue)" headerValue="%{#attr.headerValue}"
> headerKey="%{#attr.headerKey}" size="%{size}"
> emptyOption="%{#attr.emptyOption}"
>
>
> Is there a right (easy) way to still pass OGNL expression to struts tag
> which is used in tag file?
>
> Thanks,
> Qiang
>
>
>
--
View this message in context: http://www.nabble.com/Attribute-OGNL-evaluation-issue-on-struts-tag-in-tag-file-tp21732140p21935976.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Attribute OGNL evaluation issue on struts tag in tag file
Posted by Rich_m <rm...@caris.com>.
I found a solution and posted it on my thread on the opensymphony forum:
http://forums.opensymphony.com/thread.jspa?messageID=6278131
Rich_m wrote:
>
> I'm having the same problem, posted it on the opensymphony ognl forum
> here:
>
> http://forums.opensymphony.com/thread.jspa?messageID=625477
>
>
> QZ wrote:
>>
>> We were using JSP EL expression to evaluate parameter value passed from a
>> custom tag to struts tag defined in that custom tag file. After we
>> upgraded Struts from 2.0.9 to 2.0.14, we had to modify struts tag defined
>> in our tag file since JSP EL expression is not allowed any more in struts
>> tag because of changes from WW-2107.
>>
>> One problem is that, some OGNL expression parameter value can not be
>> treated as expression any more
>> when the paratemeters reach Struts tag. The value (such as "top") is
>> always treated as string literal "'top'"
>> in free marker therefore never been evaluated (returns "top" string as
>> result back).
>>
>> Here is an example:
>>
>> We pass "top" as listKey attribute value from customed tag defined in
>> select.tag.
>> If we don't check (if listkey=='top'), it would pass it as string literal
>> "'top'" to free marker
>> instead of "top" which get evaluated.
>>
>> WAS:
>>
>> <s:select name="${name}" label="%{getText('${label}')}" list="${list}"
>> listKey="${listKey}" listValue="${listValue}"
>> headerValue="${headerValue}" headerKey="${headerKey}"
>> size="${size}" emptyOption="${emptyOption}" tooltip="%{getTex….
>>
>>
>> NOW:
>>
>> <c:if test="${list != null}"> <s:set name="list"
>> value="%{getList(#attr.list)}"/></c:if>
>> <s:select name="%{#attr.name}" label="%{getText(#attr.label)}"
>> list="%{#attr.list}" listKey="#attr.listKey
>> =='top'?top:getString(#attr.listKey)"
>> listValue="getString(#attr.listValue)" headerValue="%{#attr.headerValue}"
>> headerKey="%{#attr.headerKey}" size="%{size}"
>> emptyOption="%{#attr.emptyOption}"
>>
>>
>> Is there a right (easy) way to still pass OGNL expression to struts tag
>> which is used in tag file?
>>
>> Thanks,
>> Qiang
>>
>>
>>
>
>
--
View this message in context: http://www.nabble.com/Attribute-OGNL-evaluation-issue-on-struts-tag-in-tag-file-tp21732140p22040161.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org