tiles-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Hardy <ahardy.str...@cyberspaceroad.com>
Subject Round-about mechanism wanted for common issue
Date Tue, 06 May 2008 13:18:03 GMT

I'm using Tiles to split up my JSPs so that I have a layout.jsp which contains 
the HTML headers, meta-tags, style sheet links etc. There are other tiles, one 
for menus, one for footer.

The tiles.xml contains the definitions where I re-use these tiles and specify 
the content tile which contains the HTML forms or search results etc etc.

I find now that my cascading stylesheet is getting large, and much of the style 
which it includes are only used on one page each, so I would like to put those 
CSS declarations into the pages that require them directly. Mostly it is just 
height or width attributes and occasionally some margins, borders or paddings.

I could include an individual <style> tag directly in the content tile JSP

<style type="text/css">
#mainContext div.row span.data {
     width: 23%;

But because it's not in the header, the HTML doesn't validate (at W3C):

 >>Line 100, Column 22: document type does not allow element "style" here.

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).

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?

Thanks in advance,

View raw message