struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cedric Dumoulin <ced...@apache.org>
Subject Re: [Tiles] - Definition inheritence question
Date Mon, 02 Sep 2002 14:48:05 GMT

  Hi Michael,

  When you extend a definition, all attributes from ancestor are 
inherited, and then overloaded by attributes specified in the new 
definition. In your case, you overload the 'path' attribute with a new 
value, disguarding the previous value.
  The way to go is to have an intermediate tiles (you already have it: 
plant_status_body.jsp), and a definition using this tiles. Then you use 
the definition as body.

        Hope this help,
          Cedric

Michael wrote:

>I've been playing with Tiles for several days, getting some simple
>examples to work.  I've read all the documentation several times but I'm
>missing a key part of the definition inheritence I think.  Can somebody
>please clarify this for me?  Here's what I'd like to do:
>
>I'd like to have a main page that specifies a header, menubar, body, and
>footer.  Then in the pages of my website, I'd like to insert tiles into
>the body.  So far it's very easy if I only have one tile to insert into
>the body.  But I'm really stuck on how to insert two tiles into the same
>body.  This is what I've tried:
>
>tiles-defs.xml:
>
>  <!-- Doc index page description  -->
>  <definition  name="default_layout"
>               path="/jsp/layouts/default_layout.jsp">
>	  <put name="header"  value="/jsp/common/header.jsp" />
>	  <put name="menubar" value="/jsp/common/menubar.jsp" />
>	  <put name="footer"  value="/jsp/common/footer.jsp" />
>  </definition>
>
>  <definition name="plant_status_page"
>              extends="default_layout"
>              path="/jsp/status/plant_status_body.jsp">
>    <put name="body1" value="plant_list"/>
>    <put name="body2" value="subsystme_list"/>
>  </definition>
>
>Default_layout.jsp:
>
>  <!-- Header Page Information -->
>  <tiles:insert attribute="header" />
>
>  <!-- Menu Bar -->
>  <tiles:insert attribute="menubar"/>  
>
>  <!-- Main Body Information -->
>  <tiles:insert attribute="body"/>
>
>  <!-- Copyright Information -->
>  <tiles:insert attribute="footer"/>
>
>plant_status_body.jsp:
>
><HR>TOP<HR>
>
>  <!-- Header Page Information -->
>  <tiles:insert attribute="body1" />
>
><HR>MIDDLE<HR>
>
>  <tiles:insert attribute="body2"/>
>
><HR>END<HR>
>
>This works, but the problem is I don't get the header & footer defined
>in the default_layout.jsp.  Now I can cut & paste the header & footer
>code into plant_status_body.jsp but I think there has to be a better way
>to do this.  Can someone please tell me if this is possible and how?
>
>Michael
>
>
>--
>To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
>For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>
>
>
>  
>



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


Mime
View raw message