[thelist] Server page includes: javascript and CSS belong in the header!

Hassan Schroeder hassan.schroeder at gmail.com
Fri Feb 16 18:24:17 CST 2007

On 2/16/07, Will Budreau <Will.Budreau at entrust.com> wrote:
> In our codebase, we use JSP includes and Tiles to nest JSP fragments.

> I can think of three solutions

Solution 0 would be to not use the inherently fragmented Tiles
approach :-) but ...

> 1) Specify a way for an included file/tile to add a CSS or Javascript file to the html <head>

> 2) Each JSP documents what supporting static files it needs added to the head.


How are you building these pages? At the point you're delivering the
actual View (big V, in MVC), all the content should be known.

Personally I use a complete template, generate a Content object in
the assembly pipeline and pass that as a request attribute to the
template. Then it's just (simplified!)
<!-- common stuff first -->
<!-- followed by page-unique stuff, e.g. -->
<style type="text/css">
<script type="text/javascript">

..and so on.

But you could probably adapt that to work with Tiles...

Hassan Schroeder ------------------------ hassan.schroeder at gmail.com

More information about the thelist mailing list