You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Nathan Coast <na...@codeczar.com> on 2004/02/16 09:28:41 UTC

extending nested tiles templates

Hi

I'd like to be able to nest templates within other templates. I know it can be 
done but I'm not sure I can do it the way I'm trying to do it.  AFAICT you have 
to add n tiles defs for each page you want to add where n is the depth of 
nesting within tiles.

MasterLayout.jsp and FullHistoryBody.jsp both are templates and use 
tiles:insert.  FullHistoryBody is a template for the 'body' section of the 
MasterLayout.jsp.

What I'd like to do:

   <definition name="pocweb.master" path="/layout/MasterLayout.jsp">
	<put name="title"  value="OnePort master Layout" />
	<put name="header" value="/layout/Header.jsp" />
	<put name="servnav" value="/layout/ServiceNav.jsp" />
	<put name="navbar" value="/layout/NavBar.jsp" />
	<put name="breadcrumb"   value="/layout/Breadcrumb.jsp" />
	<put name="body"   value="/layout/Body.jsp" />
	<put name="footer" value="/layout/Footer.jsp" />
   </definition>

   <definition name="pocweb.fullHistory" extends="pocweb.master" >
     <put name="body"   value="/layout/FullHistoryBody.jsp" />
   </definition>

   <definition name="appointment.FullHistoryAppointmentJSP" 
extends="pocweb.fullHistory">
     <put name="title"  value="Appointment Version History" />
     <put name="detail"   value="/pages/appointment/ViewAppointmentDetail.jsp" />
   </definition>

this fails with FullHistoryBody.jsp complainging about not being able to locate 
the detail attribute.
***************************************************************

What I have to do to make it work:

   <definition name="pocweb.master" path="/layout/MasterLayout.jsp">
	<put name="title"  value="OnePort master Layout" />
	<put name="header" value="/layout/Header.jsp" />
	<put name="servnav" value="/layout/ServiceNav.jsp" />
	<put name="navbar" value="/layout/NavBar.jsp" />
	<put name="breadcrumb"   value="/layout/Breadcrumb.jsp" />
	<put name="body"   value="/layout/Body.jsp" />
	<put name="footer" value="/layout/Footer.jsp" />
   </definition>

   <definition name="appointment.FullHistoryAppointmentJSP" extends="pocweb.master">
     <put name="title"  value="Appointment Version History" />
     <put name="body"   value="appointment.FullHistoryAppointmentJSPbody" />
   </definition>

   <definition name="appointment.FullHistoryAppointmentJSPbody" 
path="/layout/FullHistoryBody.jsp">
     <put name="detail"   value="/pages/appointment/ViewAppointmentDetail.jsp" />
   </definition>

************************************************************************

The 'problem' with this is that I have to add two tiles defs to add a single 
page.  with n levels of nesting I'd have to add n tiles defs per page.

cheers
Nathan

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org