tiles-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maven apache <apachemav...@gmail.com>
Subject Re: how to add the js refer in the page which extends the template
Date Tue, 15 Feb 2011 14:36:11 GMT
2011/2/15 Antonio Petrelli <antonio.petrelli@gmail.com>

> 2011/2/15 maven apache <apachemaven0@gmail.com>:
> > 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?


>  Antonio
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message