You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Sean Gay <se...@modus.com.au> on 2002/09/02 01:54:42 UTC

Templates tag library, nesting templates

Hey guys Im just new to the users list and was wondering whether anyone
could help me out with how to nest templates.
I have only been able to do this by the following way

---------------------------------technologies_expertise.jsp-----------------
-----------
Main file which uses 'content_includes/technologies_expertise.jsp' that also
implements a template for the content.
----------------------------------------------------------------------------
-----------------------
<%@ taglib uri='/WEB-INF/struts-template.tld' prefix='template' %>
<template:insert template='/templates/template_layout.jsp'>
 <template:put name='header' content='/common/header.jsp' />
 <template:put name='nav_level_1' content='/common/nav_level_1.jsp' />
 <template:put name='nav_level_2'
content='/common/nav_level_2_technologies.jsp' />
 <template:put name='content'
content='/content_includes/technologies_expertise.jsp' />
</template:insert>
---------------------------------/content_includes/technologies_expertise.js
p----------------------------
referenced file that uses a content template.
----------------------------------------------------------------------------
-----------------------
<%@ taglib uri='/WEB-INF/struts-template.tld' prefix='template' %>
<template:insert template='/templates/template_content.jsp'>
 <template:put name='content_border' content='page_border_tech'
direct='true'/>
 <template:put name='header_image' content='hdr_expertise.gif'
direct='true'/>
 <template:put name='page_content' content='expertise' direct='true'/>
</template:insert>

----------------------------------------------------------------------------
-------------------
Above works properly, but it means that I have to have numerous files for
the one content to display. I would prefer to do something like below but I
get an error stating "Illegal to flush within a custom tag"

<%@ taglib uri='/WEB-INF/struts-template.tld' prefix='template' %>
<template:insert template='/templates/template_layout.jsp'>
 <template:put name='header' content='/common/header.jsp' />
 <template:put name='nav_level_1' content='/common/nav_level_1.jsp' />
 <template:put name='nav_level_2'
content='/common/nav_level_2_technologies.jsp' />
 <template:put name='content'>
    <template:insert template='/templates/template_content.jsp'>
      <template:put name='content_border' content='page_border_tech'
direct='true'/>
      <template:put name='header_image' content='hdr_expertise.gif'
direct='true'/>
      <template:put name='page_content' content='expertise' direct='true'/>
    </template:insert>
 </template:put>
</template:insert>

If anyone knows how to successfully do this I would be most greatful.