Adam Winer wrote:
Laurie,
We use a Scriptlet API down in :
oracle.adfinternal.view.faces.renderkit.core.xhtml.jsLibs
... the basic gist of which is that a Renderer can say
"hey, I need function foo()", and the Scriptlet API
figures out whether that means importing a lib, or
writing out an in-place script, and if so, whether it's already
been rendered once.
Instead of using a Filter to inject into <head>, we currently
blow off the notion that <script> elements can only be in
<head>. Evil, perhaps, but there's not a browser that really
cares, and practical considerations trumped HTML purity.
But since the details are hidden inside of the Scriptlets, they
could instead just add the scripts to a list that later gets
injected by a Filter.
OK, people keep telling me 'we just write script tags inline' so maybe
I'll just follow the herd ;-) My goal was to be able to say, for a
component library I'm working on, that 'if you are using Tomahawk or ADF
Faces, you don't need any additional configuration' so if ADFF is
already working this way, it wouldn't hurt for my components to do
likewise when deployed alongside ADFF...
Note that this code is currently in "adfinternal", which
means that it is not a public API, and is not considered
legit for code external to ADF Faces to extend. One
of my major goals for the ADF Faces codebase is to
extract a public API from the current adfinternal rendering
APIs, which reminds me I need to post some support
for John's api/impl split e-mail... :)
That's a good point. If I do decide to do anything that relies on these
APIs I'll have to clearly flag what versions of ADFF are compatible.
Maybe it would make sense to move Tomahawk's AddResources / Filter based
stuff into commons so it can be re-used across Tomahawk, ADFF, Tobago
and other component libraries?
L.
-- Adam
On 2/21/06, Laurie Harper <[EMAIL PROTECTED]> wrote:
The Tomahawk components 'inject' Javascript file references into the
<head> section of the response by using a filter to buffer and
post-process the response. I'm assuming ADF Faces has some mechanism for
injecting Javascript too, but I can't seem to track it down...
I've found the code that handles serving static resources, just not the
code responsible for injecting references to Javascript files. The
reason I'm looking for it is so I can make a component library I'm
working on use it.
Can anyone give me a pointer to the right area in the ADF Faces code, or
even better a quick explanation of how to use it to do what I want?
Thanks,
L.