2009/10/21 Brian Stewart <[email protected]>: > > Can someone please tell me if there is a way to do a comparison between a > Struts2 value and a String read in from Tiles2? I'll post the code as I > think it should work below. If I just display the tiles value, I see it, but > the conditional statement doesn't seem to evaluate correctly... > > > 1<s:property value="#pagedDataBean.sortedBy"/> <!-- This prints the proper > value --> > 2<tiles:getAsString name='fieldName' ignore='false'/> <!-- This also prints > the proper value --> > > <s:if test="%{#pagedDataBean.sortedBy == <tiles:useAttribute > name='fieldName'/>}"> > ... > </s:if>
As usual, you cannot use a JSP tag inside another JSP tag, you have to use it outside. However, <tiles:useAttribute> exports an attribute as a scripting variable, <tiles:importAttribute> exports an attribute in a context (page, request, session, application) and I don't know if it can be used in a comparison with a value got from a ValueStack (I don't know Struts 2 as much as you). Antonio
