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: Round-about mechanism wanted for common issue
Date Tue, 06 May 2008 13:44:53 GMT
2008/5/6 Adam Hardy <ahardy.struts@cyberspaceroad.com>:
>  The alternative would be to keep it in a seperate CSS file and include it
> in the valid position for styles using the layout.jsp (as for the main CSS
> file).

With Tiles 2.0 it is the only way, probably...

>  However, it would be ideal if I could put the CSS in the content tile, but
> wrap it in a Tiles tag of some kind (e.g. <tiles:includeInOtherFile
> var="specialCss"> ) that would pipe the body out of that tile and into the
> layout tile:
>
>  <tiles:includeFromMemory var="specialCss">
>
>  Is that already possible? Or if not, does it sound feasible, or is my
> layout tile already written to out before the content tile is processed?

I think it is not possible this way, since, when the "body" is
processed" the "header" has already been processed and it can't come
back.

However, in Tiles 2.1 (that you can find in svn trunk) you could use
the "cascaded" attributes.
For example, if you have a different CSS segment per page, you can do:

<definition name="myDefinition" template="/layout.jsp">
  <put-attribute name="specialCss" value="${requestScope.specialCss}"
cascade="true" />
<!-- Here goes the rest of the definition -->
</definition>

Notice the use of EL in the attribute value, see the test webapp
(tiles-test) for an example. Currently there is no docs about this
(sorry, it's under development).

HTH
Antonio

Mime
View raw message