Antonio Petrelli on 06/05/08 18:02, wrote:
2008/5/6 Adam Hardy <[EMAIL PROTECTED]>:
 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?

It's not possible to put it in the body and hope that it will be
processed in the header, simply because the header gets renderer
before the body, and when you render the body it's too late to process
the header.
I think that your option is to do some pre-rendering processing, for
example using a ViewPreparer, to store the extra CSS items, and then
use them when rendering the <head>.

OK. Perhaps I could write a ViewPreparer that greps the JSP and extracts the CSS declared there.

I could write a simple taglib for the JSP to surround the CSS which would identify the portion to extract and also prevent it displaying when the JSP loads.

This depends on the ViewPreparer getting the name of the JSP file. Presumably that's in the AttributeContext.


Regards
Adam

Reply via email to