Hi Julien, did you try the use of @Import to import your js file as explained http://tapestry.apache.org/javascript.html?
Regards François 2012/1/30 Julien Martin <bal...@gmail.com>: > Hi Thiago! > > Using your advice, I managed to generate the link easily. I have also moved > the script to a separate file as advised. > > Now what remains unclear to me is that the *addScript* method takes a > String and not a url to my javascript file. > > So on the one hand I have my link, on the other my javascript file. I > understand the rationale behind the addScript method: formatting the > content of the js file with one or several variables passed as the second > argument but what I have is js file not a short script as in the > documentation: > > javaScriptSupport.addScript( > > "$('%s').observe('click', hideMe());", > container.getClientId()); > > How do I pass my js file to the addScript method or do I use another method? > > Regards, > > Julien. > > 2012/1/30 Thiago H. de Paula Figueiredo <thiag...@gmail.com> > >> On Sun, 29 Jan 2012 19:22:31 -0200, Julien Martin <bal...@gmail.com> >> wrote: >> >> Thiago, >>> >> >> Hi! >> >> >> Yes it is indeed a Tapestry page. Here is the java code for it (there is >>> no template for this page): >>> >> >> So the correct way of generating an URL for a page is to @Inject >> PageRenderLinkSource and use one of its methods. They return a Link. Pass >> the result of the toAbsoluteURI() method to your JavaScript method by >> @Inject'ing JavaScriptSupport and using its addScript() method. >> >> In addition, as you're returning JSON content, instead of return >> TextStreamResponse, you can return a JSONObject or a JSONArray. >> >> >> -- >> Thiago H. de Paula Figueiredo >> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, >> and instructor >> Owner, Ars Machina Tecnologia da Informação Ltda. >> http://www.arsmachina.com.br >> --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org