I was afraid that would be the answer :-( I really wanted to avoid having files with page fragments that weren't well formed like that... I'll have to dig into the Tiles code and see how ameanable the rendering model is to being 'masaged' into supporting what I want it to do :-)

What's wrong with starting tiles names with '/' by the way? I seem to remember that Struts complained when I didn't, though I've been doing it this way long enough I don't recall the details.

L.

[EMAIL PROTECTED] wrote:

Errr.... No... Let's start from the beginning.
1. Don't give to Tiles definitions names starting with "/".
2. You can put a Tiles definitions inside another tiles definition. For
example:
<definition name="section.one" path="/layout/testLayout1.jsp">
    <put name="top" value="/tiles/somewhat1.jsp" />
    <put name="bottom" value="/tiles/somewhat2.jsp" />
</definition>

<definition name="page.one" path="/layout/classicLayout.jsp">
    <put name="header" value="/tiles/header.jsp" />
    <put name="left" value="/tiles/menu.jsp" />
    <put name="body" value="section.one" />
    <put name="footer" value="/tiles/footer.jsp" />
</definition>

I hope this clears your doubts.
Ciao
Antonio Petrelli

Laurie Harper wrote:


Hi, how do I create layout tile hierarchies so that one layout extends

another and contributes additional content to it? What I'd like to have is a base layout which contains markup common to every page, and then 'child' layouts that extned the base layout and add section-specific additional markup. Page tiles would then use the 'child' layout to get the page and section layout rendered. Something like this:

   <definition name="/base.layout" path="/pages/base/layout.jsp">
       <put name="title" value="PAGE TITLE"/>
   </definition>

<definition name="/section.layout" extends="/base.layout"

path="/pages/section/layout.jsp">

       <put name="title" value="The Section Title"/>
   <put name="secion-name" value="SECTION NAME"/>
   </definition>

   <definition name="/section.view" extends="/section.layout">
   <put name="section-name" value="The Section Name"/>
       <put name="content" value="/pages/section/view.jsp"/>
   </definition>

That's how I tried to set it up, but the 'path' attribute on

/section.layout overrides the 'path' attribute on /base.layout, so the content of /pages/base/layout.jsp isn't rendered. Also, the implicit 'content' attribute used by /pages/base/layout.jsp and /pages/section/layout.jsp conflict. I also tried this:

   <definition name="/base.layout" path="/pages/base/layout.jsp">
       <put name="title" value="PAGE TITLE"/>
   </definition>

   <definition name="/section.layout" extends="/base.layout">
       <put name="title" value="The Section Title"/>
   <put name="secion-name" value="SECTION"/>
   <put name="content" path="/pages/section/layout.jsp"/>
   </definition>

   <definition name="/section.view" extends="/section.layout">
   <put name="secion-name" value="The Section Name"/>
       <put name="section-content" value="/pages/section/view.jsp"/>
   </definition>

but that didn't work as the 'section-name' attribute isn't defined in

the tiles context available to /pages/section/layout.jsp. Moving the 'put' for the 'content' attribute down into the /section.view definition doesn't seem to help; I get the same error.

Logically, I'm looking for something like this:

+---------------+           +----------------------+
| /base.layout  |           | /section.layout      |
|---------------|           |----------------------|
| title: String | includes  | title: String        |
| content: JSP  |---------->| section-name: String |
+---------------+           | section-content: JSP |
                           |----------------------|
                           | title = "The Se..."  |
                           | content = /path/...  |
                           +----------------------+
                                   |
                                   | includes
                                   |
                                   V
                        +-----------------------------+
                        | /section.view               |
                        |-----------------------------|
                        | section-name = "The se      |
                        | section-content = /path/... |
                        +-----------------------------+

Is what I'm trying to do possible? Is my objective clear from the above?

I can put together a more complete demo if necessary.

L.


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to