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: context of parameters
Date Mon, 03 Sep 2007 18:09:06 GMT
2007/9/3, Adam Hardy <ahardy.struts@cyberspaceroad.com>:
> I have created a layout JSP to use as a template for an abstract layout
> definition. I extend it with my concrete definition, for example (simplified):
> <definition name="layout.tile" template="layout.jsp">
>    <put-attribute name="headerTile" type="template" value="header.jsp" />
>    <put-attribute name="menuTile" type="template" value="menu.jsp" />
> </definition>
> <definition name="categoryList.tile" extends="layout.tile">
>    <put-attribute name="bodyContentTile" value="categoryList.jsp" />
>    <put-attribute name="title" value="category.list.pageHeader" />
>    <put-attribute name="subMenuTile" value="submenu.jsp" />
> </definition>
> The "title" attribute varies between concrete definitions. Unless I declare the
> "title" attribute again in the layout template, the header tile and header.jsp
> cannot see it, like this:
> <tiles:importAttribute />
> <body>
>    <div id="container">
>      <div id="header">
>        <tiles:insertAttribute name="headerTile">
>          <tiles:putAttribute name="title" value="${title}" />
>        </tiles:insertAttribute>
>      </div>
>      <div id="content">
>        <tiles:insertAttribute name="bodyContentTile"/>
>      </div>
>      <div id="subMenu">
>        <div class="subMenu">
>          <tiles:insertAttribute name="subMenuTile"/>
>        </div>
>      </div>
>    </div>
> </body>
> Is this the right way to do it or is there a more elegant way?
> I know that once this prototype goes into development, there will be many more
> attributes defined in the concrete definition but used in other tile templates.
> I would be glad to find out whether there is an automatic way of putting these
> attributes into the context of the pages where I need them?
> I have looked hard at the possibility of 'nesting' the definitions, but that
> doesn't seem to be the solution, or at least it would be no more elegant than
> the above.

Currently there is no support for the so-called "pass-through" attributes. See:
Anyway I opened an issue for this, since you are not alone:
Notice that, eventually, it will be implemented in Tiles 2.1

If you want a ready-to-use solution, check out again the preparer: you
could add a request-scoped attribute that is visible across the entire



View raw message