tiles-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Stewart <Brian.Stew...@ahom.com>
Subject RE: Comparing Struts2 values with Tiles2 strings
Date Thu, 22 Oct 2009 13:22:31 GMT
Thanks Antonio!

I had confused nesting jsp tags with nesting a jsp tag within html which is allowed...
<div class="sortDesc" onclick="document.sort.action='
<tiles:getAsString name='action' ignore='false'/>';
document.sort.submit();">

Your suggestion completely solved my problem.  I had no idea how to pull tiles attributes
into other scopes which was the missing piece of the puzzle.

	<tiles:importAttribute name="fieldName" scope="request"/>
	<s:if test="%{#pagedDataBean.sortedBy == #request.fieldName}">
	...
	</s:if>

Thanks again, and let me say that I really appreciate the work that you guys have been doing
on Tiles2.  It is an invaluable tool.

Regards,
Brian Stewart
mrbcstewart@yahoo.com
-----Original Message-----
From: Antonio Petrelli [mailto:antonio.petrelli@gmail.com] 
Sent: Thursday, October 22, 2009 2:31 AM
To: users@tiles.apache.org
Subject: Re: Comparing Struts2 values with Tiles2 strings

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
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
This message is confidential, intended only for the named recipient
and may contain information that is privileged or exempt from
disclosure under applicable law.  If you are not the intended
recipient, you are notified that the dissemination, distribution or
copying of this message is strictly prohibited.  If you receive
this message in error, or are not the named recipient, please
notify the sender at the email address listed above.


Mime
View raw message