You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Rick Reumann <ri...@gmail.com> on 2008/01/08 16:01:27 UTC

Old skool hopefully simple question - Tiles1 and nesting??

Ok, I'm stuck using some old technologies here. Been googling around for
this but still seemed stumped. All I want to do is to be able to extend a
base tile definition that uses a JSP for main layout, and then create a
sublayout definition that can be extended by other page definitions.
Basically I want to nest tiles. Stripped out some content below to show what
I'm trying to do:

<definition name="main.layout" path="/mainLayout.jsp">
</definition>

<definition name="dashboard.layout" extends="main.layout">
    <put name="content" value="/dashboardLayout.jsp"/>
</definition>

<definition name="tasks.page" extends="dashboard.layout">
    <put name="page_title" value="Tasks" type="string"/>
    <put name="dashboardContent" value="/WEB-INF/jsp/tasks.jsp"/>
</definition>

mainlayout.jsp
--------------
//html stuff - header, top navigation, footer
<tiles:insert attribute="content" />

dashboardLayout.jsp
------------------
//html stuff has a unique left nav for dashboard pages
<tiles:insert attribute="dashboardContent" />


*** The part not working is the <tiles:insert attribute="dashboardContent"
/> -
that JSP (tasks.jsp) is never injected. The path is ok, bc that same path to
tasks.jsp is used as "content" it will show up in the mainLayout.

Any ideas what I'm missing? I'm hoping it's just a a "duh" moment:)

-- 
Rick

Re: Old skool hopefully simple question - Tiles1 and nesting??

Posted by Antonio Petrelli <an...@gmail.com>.
2008/1/8, Rick Reumann <ri...@gmail.com>:
> <definition name="main.layout" path="/mainLayout.jsp">
> </definition>
>
> <definition name="dashboard.layout" extends="main.layout">
>     <put name="content" value="/dashboardLayout.jsp"/>
> </definition>
>
> <definition name="tasks.page" extends="dashboard.layout">
>     <put name="page_title" value="Tasks" type="string"/>
>     <put name="dashboardContent" value="/WEB-INF/jsp/tasks.jsp"/>
> </definition>


You are trying to fill the "dashboardContent" attribute of
"tasks.page" definition, that uses the "mainLayout.jsp" page as a
template, that has no "dashboardContent" attribute, so it is "obvious"
that it does not show up. Tiles 1 (and Tiles 2) do not support
pass-through attributes! (I am trying to support them in Tiles 2 but
this is another story)

So the solution is to create a definition that fills the
"dashboardContent" attribute of "dashboardLayout.jsp" template, and
then it will be included in the "tasks.page" definition.
IOW:

<definition name="inner.page" template="dashboardLayout.jsp">
  <put name="dashboardContent" value="/WEB-INF/jsp/tasks.jsp"/>
</definition>

<definition name="tasks.page" extends="dashboard.layout">
    <put name="page_title" value="Tasks" type="string"/>
    <put name="dashboardContent" value="inner.page"/>
</definition>

HTH
Antonio

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