I'm wondering if I'm doing something wrong, (or at least not using the "Best
Practices").  Because my Tiles site has a LOT of moving parts, way more than
if I didn't use this simplifying technology at all.  First I have to create
an essentially empty file for each page that uses Tiles, something like:

<%@ taglib prefix="tiles" uri="http://struts.apache.org/tags-tiles-el"%>
<tiles:insert definition="login.pane"/>

Since our site always has a header (with a title), footer, and body section,
I defined a main layout with those sections and defined it in tiles-def.xmlas:

 <definition name="site.layout" path="/site-layout.jsp">
   <put name="title" value="site.layout.title"/>
   <put name="pagetitle" value="passion"/>
   <put name="header" value="/tiles/header.jsp"/>
   <put name="body" value="/tiles/empty.jsp"/>
   <put name="footer" value="/tiles/footer.jsp"/>
   <put name="init" type="string">
     /**
      * Page Level Initialization
      */
     function init () {
     } //init
   </put>
   <putList name="styles">
   </putList>
   <putList name="scripts">
     <add type="string" value="javascript/util.js"/>
   </putList>
 </definition>

 <definition name="main.index" extends="site.layout">
   <put name="header" value="/tiles/index-header.jsp"/>
   <put name="body" value="/tiles/index-body.jsp"/>
   <put name="footer" value="/tiles/index-footer.jsp"/>
 </definition>


Then since 90% of our files are separated into a blue section (with
breadcrumbs) at the top of the page and a white section at the bottom, I
extended the main layout definition to add those tiles.  But to extend a
tile it apparently takes two definitions (which doesn't make any sense to
me):

 <definition name="default.pane" extends="site.layout">
   <put name="body" value="default.layout" type="definition"/>
 </definition>

 <definition name="default.layout" path="default-layout.jsp">
   <put name="bluearea" value="/tiles/blank.jsp" type="page"/>
   <put name="whitearea" value="/tiles/blank.jsp" type="page"/>
   <putList name="breadcrumbs">
     <add value="/|head.home" type="string"/>
   </putList>
 </definition>

And since our site is internationalized we have externalized text in
resources as well as internationalized tiles_defs_fr.xml files.  It seems
like Tiles is making flow and maintainability harder not easier.  Is there a
best practice document somewhere that defines how to use this technology to
make life easier rather than just making more work?
 (*Chris*)

Reply via email to