We were using JSP EL expression to evaluate parameter value passed from
a custom tag to struts tag. 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? 




Reply via email to