2010/7/27 Motley, Jeffery <[email protected]>:
> What is the appropriate place/way to define javascipt/css for a jsp that
> is using a Tiles definition.? I would like each custom page to use the
> master layout but override the body/content section. However I need
> custome javascript/css for each page.

Use string attributes. For example:

<definition name="master" template="/jsp/master_layout.jsp">
  <put-attribute name="css" value="/css/default.css" type="string" />
  <put-attribute name="script" value="/js/default.js" type="string" />
</definition>

<definition name="extended" extends="master">
  <put-attribute name="css" value="/css/overridden.css" type="string" />
  <put-attribute name="script" value="/js/overridden.js" type="string" />
</definition>

And, in master_layout.jsp:

...
<head>
  <tiles:importAttribute name="css" />
  <link href="${css}" rel="stylesheet" type="text/css" />
  <tiles:importAttribute name="script" />
  <script type="text/javascript" src="${script}"></script>
</head>

HTH
Antonio

Reply via email to