Indeed, but its not declarative and it doesn't address style sheets.
Like I said, I'm not hell-bent on a declarative solution, but I do not
want to:
1) @Inject/@Path my css ...
2) .. and provide a getter ...
3) .. for every page!
On top of that it would be quite nice to know only from the template
what other resources (css, js, etc) the page requires. As I said I'd
settle for a class level annotation that could be applied to
pages/components to express what css/js assets should be included. While
not declarative, its a simple, consistent, at-a-glance way to declare
and know what assets a page/component needs.
Carl Pulley wrote:
You can also add javascript code into the document head via PageRenderSupport
(see Form.java for a concrete example).
redijedi wrote:
I'm trying to create a component that will allow me to define blocks
of HTML to insert into the head. I think this would be useful for ad
hoc JS, style declarations, etc. I know that this can be inserted
using other mechanisms like:
Element head = writer.getDocument().find("html/head");
and inserting your element manually, but this isn't pretty or
easy/possible for the script or style tag contents.
I know that an alternative is just to slap it in the page where the
component is rendered, but that's just sloppy.