tiles-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antonio Petrelli <antonio.petre...@gmail.com>
Subject Re: Comparing Struts2 values with Tiles2 strings
Date Thu, 22 Oct 2009 07:30:37 GMT
2009/10/21 Brian Stewart <Brian.Stewart@ahom.com>:
> 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
> 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).


View raw message