If you want include some script in *all* pages you may conribute to MarkupRenderer service. See org.apache.tapestry5.services.TapestryModule as example
Mihail 16 июля 2011 г. 19:05 пользователь Rendy Tapestry <rendy.tapes...@gmail.com>написал: > Hi Mihail, > > Thank you for your response. If that is how the correct thing should > happened, I will accept it. I come to this question because in Tapestry 4, > I > am using decorator to build a template. In default.jsp I put an import to > jquery lib once and never import it again in every page that use the > template. > > Thanks, > Rendy > > 2011/7/16 Михаил Слободянюк <slobodyanu...@gmail.com> > > > Hi, Rendy! > > > > You must import every used script in every page/component class same as > > import other used java classes. > > > > Mihail Slobodyanuk. > > > > 2011/7/16 Rendy Tapestry <rendy.tapes...@gmail.com> > > > > > Hi All, > > > > > > I am using tapestry layout component, in page class I add @Import > > > annotation > > > to import jquery library. I have another page that is being used along > > with > > > the layout component and having @Import annotation to import specific > > > javascript for that page. That javascript used jquery inside it, the > > > problem > > > is, jQuery() is not recognized in that script. Solution I have right > now, > > > is > > > reimport the same jquery library in the page class, every time I need > > > jquery. In my opinion that is bothersome. > > > > > > Here is the detail : > > > > > > @Import(library = "context:javascript/jquery-1.6.2.min.js") > > > public class Layout > > > { > > > ... > > > } > > > > > > > > > and > > > @Import(library = "context:javascript/test.js") > > > public class User > > > { > > > ... > > > } > > > > > > Inside test.js, I used jQuery, but an error show up telling that jQuery > > is > > > not recognized. But if I change User class to reimport jQuery the > problem > > > solved. > > > > > > @Import(library = {"context:javascript/jquery-1.6.2.min.js", > > > "context:javascript/test.js"}) > > > public class User > > > { > > > ... > > > } > > > > > > Any suggestion please ? > > > > > > > > > Thanks, > > > Rendy. > > > > > >