If you search the list archives, I know I put some examples up here before. (*Chris*)
On Tue, Feb 15, 2011 at 6:46 AM, Antonio Petrelli < [email protected]> wrote: > 2011/2/15 maven apache <[email protected]>: > > 2011/2/15 Antonio Petrelli <[email protected]> > > > >> 2011/2/15 maven apache <[email protected]>: > >> > And now I need some javascripts in the home.jsp,however I do not know > >> where > >> > to add it. > >> > > >> > I can add it in the home_body.jsp,but I prefer to add it in a external > >> > file,so where to define it? > >> > > >> > I mean where to write this <script ... src=xx.js /> ? > >> > >> This is the way I prefer, however I think there is plenty of similar, > >> or better, solutions. > >> First of all, identify the outer template, the one containing the > >> <HEAD> elements. > >> In this template, import a list attribute and iterate over it to > >> create all script elements: > >> > >> <tiles:importAttribute name="scriptList" /> > >> <c:forEach values="${scriptList}" var="script"> > >> <script src="${script}" ...></script> > >> </c:forEach> > >> > >> In all your definitions (or on all base definitions you have) put > >> these attributes: > >> > >> <definition name="...." template="_thetemplateabove_"> > >> <put-list-attribute name="scriptList"> > >> <add-attribute value="/scripts/xx.js"> > >> ... > >> </put-list-attribute> > >> </definition> > >> > >> Do you like it? > >> > >> > > Thanks for your reply. > > > > In fact,I am not exactly sure I know how to do. > > > > Can you give me a live example according my example? > > No live examples, sorry. This is the doc about list attributes: > http://tiles.apache.org/framework/tutorial/advanced/list-attributes.html > > Antonio >
