You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Garner, Shawn" <sh...@pearson.com> on 2006/02/03 16:24:15 UTC
[tiles] question on tiles functionality
I was looking at the examples at
http://struts.apache.org/struts-tiles/examples.html
<http://struts.apache.org/struts-tiles/examples.html> and I didn't really
see a good example of what I was looking for.
I'm doing something like this for every page:
file: somepage.jsp
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>
<tiles:insert template="layout.jsp">
<tiles:put name="title" value="This is the title." />
<tiles:put name="header" value="header.jsp" />
<tiles:put name="body" direct="true" >
<!-- Page Content Goes Here -->
</tiles:put>
<tiles:put name="footer" value"footer.jsp"/>
</tiles:insert>
However this seems kind of repetitive since the only thing that changes from
page to page is the title and body and would like to do something like this:
file: WEB-INF/tiles-defs.xml
< tiles:definition name="templateDefinition" path="/layout.jsp">
<tiles:put name="title" value="This is the title." />
<tiles:put name="header" value="header.jsp" />
<tiles:put name="body" value="body.jsp" />
<tiles:put name="footer" value"footer.jsp"/>
</definition>
file: somepage.jsp
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>
<tiles:definition name="thisPage" extends="templateDefinition">
<tiles:put name="title" value="This Pages Overriden Title"/>
<tiles:put name="body">
<!-- Page Content Goes Here -->
</tiles:put>
</tile:definition>
<tiles:insert beanName="thisPage" />
Is this possible?
Shawn
****************************************************************************
This email may contain confidential material.
If you were not an intended recipient,
Please notify the sender and delete all copies.
We may monitor email to and from our network.
****************************************************************************