You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tiles.apache.org by Yevaru Neynu <yn...@gmail.com> on 2009/09/23 18:27:06 UTC

Problem with put-list-attribute

Hello,

I have an application built on Struts 2.1.6 and Tiles 2.1.3.  I use wildcard
support both in Struts and Tiles.  The wild card support in Tiles 2.1.3
works fine for the most part, except for cascade attributes and
put-list-attribute.  I will elaborate what the issues are with
cascade/inherit attributes are some other day, but I would like to get a
solution to my put-list-attribute problem.

Here is a snippet from my struts definition file:

<pre>
  <!-- Admin Center action mappings -->
  <package name="adminCenter" extends="mywebapp" namespace="/adminCenter">
    <default-action-ref name="landing" />

    <action name="*" class="my.webapp.actions.BaseAction">
      <result type="tiles">
        <param name="location">workspace.adminCenter.{1}</param>
      </result>
      <result name="success" type="tiles">
        <param name="location">workspace.adminCenter.{1}</param>
      </result>
    </action>
  </package>
</pre>

Here is a snippet from my tiles definition file:
<pre>
  <definition name="workspace.*.*" extends="workspace.default">
    <put-attribute name="title" value="{1}.{2}.pageTitle" />
    <put-attribute name="sectionId" value="{1}" />
    <put-attribute name="leftNav" value="/WEB-INF/tiles/menu_{1}.jsp" />
    <put-attribute name="content" value="/WEB-INF/content/{1}/{2}.jsp" />
    <put-attribute name="pageTitle" value="{1}.{2}.pageTitle" />
    <put-attribute name="pageDescription" value="{1}.{2}.pageDescription" />
    <put-list-attribute name="breadCrumbs">
      <item value="home" link="/home" />
      <item value="{1}" link="/{1}/landing" />
      <item value="{1}.{2}.pageTitle" link="/{1}/{2}" />
    </put-list-attribute>
  </definition>
</pre>

In my JSP I have the following code:

<pre>
  <tiles:importAttribute name="breadCrumbs" />
  <c:forEach var="item" items="${breadCrumbs}">
    <a href="${item.link}">${item.value}</a>&nbsp;&#187;&nbsp;
  </c:forEach>
</pre>

This is what I get in my rendered page:

  *home » {1} » {1}.{2}.pageTitle**
*
This is what I was hoping for:

 * home » adminCenter » adminCenter.manageProfile.pageTitle*

BTW, the values here are actually keys in a localized file that I will use
<s:text> tag to look up and populate.  For now I want to make sure I atleast
get the correct key names generated from the tiles attribute.

How can I make wild cards work here?

Any help here is highly appreciated.

Thanks,
-yn-

Re: Problem with put-list-attribute

Posted by Antonio Petrelli <an...@gmail.com>.
2009/9/23 Yevaru Neynu <yn...@gmail.com>:
> The wild card support in Tiles 2.1.3
> works fine for the most part, except for cascade attributes and
> put-list-attribute.

I just discovered (errrr.... :-D ) that Tiles 2.1.x does not support
wildcards for cascaded and list attributes. Tiles 2.2.0 works with
cascaded attributes but not with list attributes.
Can you open a JIRA issue please?

Antonio