tiles-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Hardy <ahardy.str...@cyberspaceroad.com>
Subject Re: Round-about mechanism wanted for common issue
Date Tue, 06 May 2008 15:14:42 GMT
Antonio Petrelli on 06/05/08 14:44, wrote:
> 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>

So if I made a taglib that stored the CSS in its body into the request 
attribute, e.g. requestScope.specialCss, a bit like this:

<adam:style var="specialCss">
#ContextBody div.repo span { width: 25px; }
</adam:style>

then I could achieve this? Or do you mean that it's not possible?

I don't know what order the various tiles parts are executed.

My layout.jsp definition is inherited by every JSP like so:

   <definition name="layout.tile" template="/WEB-INF/jsp/layout.jsp">
     <put-attribute name="focalPointTile" type="template"
       value="/WEB-INF/jsp/focalpoint.jsp" />
     <put-attribute name="smallPrintTile" type="template"
       value="/WEB-INF/jsp/smallprint.jsp" />
     <put-attribute name="contextHeaderTile" type="template"
       value="/WEB-INF/jsp/contextheader.jsp" />
     <put-attribute name="menuTile" type="template"
       value="/WEB-INF/jsp/menu.jsp" />
     <put-attribute name="subMenuTile" type="template"
       value="/WEB-INF/jsp/submenu.jsp" />
     <put-attribute name="tilesBrowserTitle" type="string"
       value="general.browserTitle" />
   </definition>
   <definition name="categoryList.tile" extends="layout.tile">
     <put-attribute name="bodyContentTile"
       value="/WEB-INF/jsp/category/list.jsp" />
     <put-attribute name="tilesContextHeader" type="string"
       value="category.list.pageHeader" />
     <put-attribute name="subMenuTile"
       value="/WEB-INF/jsp/category/submenu.jsp" />
   </definition>


Mime
View raw message