You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Matthew Hughes <ma...@gmail.com> on 2005/02/17 22:36:49 UTC

Tiles Question

I think I am misunderstanding something.  I have two layout JSPs in my
application

doc.mainLayout
doc.admin

<definition name="mainLayout" path="/layout/mainLayout.jsp">
  ...<put name="footer" value="null"  type="string"/>
</definition>
  
<definition name="admin" path="/layout/adminLayout.jsp"
extends="doc.mainLayout" />

Basically mainLayout.jsp does 99% of the layout work.  adminLayout.jsp
just looks like this:

------adminLayout.jsp-----------
<%@ page language="java" contentType="text/html; charset=iso-8859-1" %>
<%@ taglib prefix="tiles" uri="struts-tiles" %>
Extra text
<tiles:insert definition="doc.mainLayout" flush="true" />
---------


When I try to have a JSP use doc.admin as a layout, it blows up.  What
is happening?

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


RE: Tiles Question

Posted by "David G. Friedman" <hu...@ix.netcom.com>.
Matthew,

I don't think that "extends" can be used with the "path" attribute.  I have
always understood, and practiced, tiles where one definition extends the
main definition (like a template) and overloads the COMPONENTS of the
original template.  I have always thought extends should NEVER be used with
path.  Using it that way, I have never had a problem.    Can you change your
templates to something like the below, where the "admin" section is blank in
the original template but overloaded to show your admin parts jsp in the
"admin" definition?  I.E. like inserting an admin menu in to the page.
Example follows:

<definition name="mainLayout" path="/layout/mainLayout.jsp">
  ...<put name="footer" value="null"  type="string"/>
  <put name="admin" value="" /> **** Blank for most layouts
</definition>

<definition name="admin" path="/layout/adminLayout.jsp"
extends="doc.mainLayout">
	<put name="admin" value="/layout/adminInsert.jsp" /> *** Added to show a
piece in the page for this admin template
</definition>

Then, in your /layout/mainLayout.jsp, you can have a <tiles:put name="admin"
... /> which will show your admin information if your Forward goes to the
"admin" tile, but nothing for the "mainLayout" tile or any new tiles which
might extend that layout.

THAT is how I do my templating with tiles.  So far, I've had no problems.

Regards,
David



-----Original Message-----
From: Matthew Hughes [mailto:matt.developer@gmail.com]
Sent: Thursday, February 17, 2005 4:37 PM
To: user@struts.apache.org
Subject: Tiles <extends> Question


I think I am misunderstanding something.  I have two layout JSPs in my
application

doc.mainLayout
doc.admin

<definition name="mainLayout" path="/layout/mainLayout.jsp">
  ...<put name="footer" value="null"  type="string"/>
</definition>

<definition name="admin" path="/layout/adminLayout.jsp"
extends="doc.mainLayout" />

Basically mainLayout.jsp does 99% of the layout work.  adminLayout.jsp
just looks like this:

------adminLayout.jsp-----------
<%@ page language="java" contentType="text/html; charset=iso-8859-1" %>
<%@ taglib prefix="tiles" uri="struts-tiles" %>
Extra text
<tiles:insert definition="doc.mainLayout" flush="true" />
---------


When I try to have a JSP use doc.admin as a layout, it blows up.  What
is happening?

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


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