On Mon, 23 Jun 2014 10:53:38 -0300, Numa Schmeder <[email protected]> wrote:

Hello,

Hi!

I am using Tapestry 5.4 beta 6.
I am trying to add a script block at the very end of the page body, after tapestry has written all its javascript. I know there are 2 ways: using javascriptSupport.addScript or javascriptSupport.require or creating one js file par page and load it via AMD.

You forgot about creating one .js file and using @Import.

But i want it to output a simple raw javascript block at the very end of the page. I tried to create a component “Javascript” to do just that, but I can’t figure how to render at the very end of the page after all other javascript. The reason is that sometimes outputting a block in the main page is simpler than to create one js file per page and then to require it.

It may be simpler, but it doesn't pay off in the end. In addition, you don't need to create one .js file for each page: you can create a single one containing all the JS code you want and @Import it everywhere you need it. Tapestry will only include it once, no matter how many components @Import it.

Also the javaScriptSupport.addScript method is deprecated, the javaScriptSupport.require should be used, but it does not the same.
What is the equivalent of addScript in Tapestry5.4

There's none, exactly because adding raw JavaScript in Java isn't the best option.

Is there a way to bypass pageinit to initialize or add scripts and have them at the end of the page ?

You can write and contribute a MarkupRendererFilter, but then it's not a component anymore.

--
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to