myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Kitching <>
Subject Re: A simple alternative to the ExtensionFilter
Date Fri, 23 Mar 2007 02:46:19 GMT
Mike Kienenberger wrote:
> Roger blogged,
>> With separate build and render phases, you could have a <h:head> 
>> component which
>> other components could add resources to as they are created during the 
>> tree build.
> Hmm.   I wonder if we could implement this for facelets/branch 1.2.

Probably not.

The point is that components don't know at the time they are *created* 
whether they want to insert stuff into the head or not; they only know 
that at *render* time. And by then the head tag has already rendered 
itself. Well, unless we allow every component in the page to output its 
required resources regardless of whether it is later rendered or not.

A head tag could be useful though; currently the ReducedHTMLParser is 
needed to parse the page and find the <head> tag. It's not simply a 
matter of looking for that string due to things like
   <!-- the <head> is not here -->
     var s = "<head>";
etc. However a head tag could output a unique marker like
which could more easily be scanned for by the ExtensionsFilter. This 
marker approach is already used for figuring out where to insert 
serialized client state etc.

Items 1,2 and 3 of the blog are all issues that could be pretty easily 
fixed in the ExtensionsFilter. Not that I'm claiming it's a great 
solution, but a fixed ExtensionsFilter would be better than hand-coding 
resources in the head section.



View raw message