You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Julien HENRY <he...@yahoo.fr> on 2008/03/29 10:53:34 UTC

[T5] How to add JavaScript in a component used in a layout

Hi,

I'm using a custom JAR-packaged component in a template. When I use the component directly in a page (Start.tml) I have both JavaScript and CSS file included in the HTML. But when I try to put the component in my application layout (Layout.tml), there is only the CSS file. No JavaScript.
In my component, I have also the following method:

@IncludeJavaScriptLibrary("${path}/component.js")
@IncludeStylesheet("${path}/component.css")
public class MyComponent {

....

void beginRender(MarkupWriter writer) {
        
        _pageRenderSupport.addScript("setup();");
        
        writer.cdata("Foo Bar");
}


On my finale page, I have the text "Foo Bar" displayed but no <script> tag at all. Only the component.css.

Can you help me to solve this problem.

Thanks

Julien




      _____________________________________________________________________________ 
Envoyez avec Yahoo! Mail. Plus de moyens pour rester en contact. http://mail.yahoo.fr

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org