Antonio probably has some other suggestions, but here are my 2 cents...

If you can anticipate which pieces you might want to include in child tiles, 
just put a placeholder for them in the parent layout.  For example, I 
anticipate that I will have custom Javascript in each page.  I have setup the 
base layout and had it include a placeholder (ignoring it if it is not present) 
that can be filled in if needed by users of this layout...

baseLayout.jsp includes...
<%@ taglib uri="http://tiles.apache.org/tags-tiles"; prefix="tiles" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
        <head>
...
<!--==========-->
<!-- scripts  -->
<!--==========-->
<tiles:insertAttribute name="javascript" ignore="true"/> 
<!--==========-->
<!-- styles   -->
<!--==========-->
<link href="css/cprocessing.css" rel="stylesheet" type="text/css" />
<link href="../../css/base.css" rel="stylesheet" type="text/css"/>
...

tiles-default contains this definition...
<definition name="layout.base"  
template="/WEB-INF/webtiles/common/layout/baseLayout.jsp">

tiles-search contains this definition...
<definition name="layout.cSearch"                               
extends="layout.base">
... 
<put-attribute name="javascript"        
value="/WEB-INF/webtiles/cSearch/javascripts.jsp" />

javascripts.jsp contains... 
<script type="text/javascript" src="js/pageTimer.js"></script>


Regards,
Brian Stewart

-----Original Message-----
From: anyz [mailto:[email protected]] 
Sent: Friday, December 11, 2009 11:41 AM
To: [email protected]
Subject: Resource import on individual pages

I have a base tile definition and various tiles extend it. The static
resource like css, js are imported throuhg <link> and <Script> tags in base
tile. Similalry various java files are imported though import directive in
base tile jsp page. However each child type has its own js, css and java
import file. How can i import resources for individual pages instead of
putting everything in base tile. Also html <body> and <head> tags are
present only in base tile so is it good practice to import resource in child
tiles even then.

Thanks<HTML><BODY><P><hr size=1></P>
<P><STRONG>This message is confidential, intended only for the named recipient 
and may contain information that is privileged or exempt from disclosure under 
applicable law.  If you are not the intended recipient, you are notified that 
the dissemination, distribution or copying of this message is strictly 
prohibited.  If you receive this message in error, or are not the named 
recipient, please notify the sender at the email address listed 
above.</STRONG></P></BODY></HTML>

Reply via email to