You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Irv Salisbury <ir...@gmail.com> on 2006/10/17 22:00:28 UTC

Tiles "put" page using tiles:insert

First, is this the appropriate list for tiles questions?  If not, sorry, and
can someone tell me a better one...

I have the following two defintions in my tiles-def.xml file:

    <definition name=".tiles.basePage" path="/pages/tiles/basePage.jsp">
            <put name="additionalHead" value="/pages/tiles/empty.jsp" />
            <put name="body"   value="/pages/tiles/empty.jsp" />
            <put name="footer"   value="/pages/tiles/footer.jsp" />
            <put name="pageName" value="This will be your page name"/>
    </definition>

    <definition name=".tiles.index" extends=".tiles.basePage">
        <put name="pageName" value="index"/>
        <put name="additionalHead" value="/pages/indexHead.jsp" />
        <put name="body" value="/pages/indexBody.jsp"/>
    </definition>

In the first definition, I have a footer attribute I am using.  However,
inside the /pages/indexBody.jsp of the second definition (which extends the
first) I want to do a <tiles:insert attribute="footer"/>  It is complaining
that it can't find it.  Is there a way to do this?  The reason I want to do
this is because I want to have a common footer attribute that sub
definitions can then use inside the body.  If there is a better way, I am
all for it.  It is my first tiles application, so learning as I go here.

I was able to get it to work by inside basePage.jsp I did:

    <tiles:insert attribute="body">
        <tiles:put name="footer" value="/pages/tiles/footer.jsp"/>
    </tiles:insert>

However, that isn't exactly what I was looking for.  In a later section, I
want to do:

    <definition name=".tiles.leftNavPage" extends=".tiles.basePage">
            <put name="body"   value="/pages/tiles/leftNavPage.jsp" />
            <put name="left" value="/pages/tiles/emtpy.jsp"/>
            <put name="top" value="/pages/tiles/emtpy.jsp"/>
            <put name="center" value="/pages/tiles/emtpy.jsp"/>
            <put name="right" value="/pages/tiles/emtpy.jsp"/>
            <put name="bottom" value="/pages/tiles/emtpy.jsp"/>
    </definition>

And inside body I want to use left, top, center, right and bottom, and then
allow subpages to override the left, top, center right or bottom section.

If I am going about this wrong, please help me see the correct way to do it.

Thanks,

Irv

[tiles] Re: Tiles "put" page using tiles:insert

Posted by Antonio Petrelli <ap...@apache.org>.
Irv Salisbury ha scritto:
> First, is this the appropriate list for tiles questions?  If not, 
> sorry, and
> can someone tell me a better one...

Yes it is! But just a note: next time put a "[tiles]" prefix in your
subject field.

> I have the following two defintions in my tiles-def.xml file:
>
>    <definition name=".tiles.basePage" path="/pages/tiles/basePage.jsp">
>            <put name="additionalHead" value="/pages/tiles/empty.jsp" />
>            <put name="body"   value="/pages/tiles/empty.jsp" />
>            <put name="footer"   value="/pages/tiles/footer.jsp" />
>            <put name="pageName" value="This will be your page name"/>
>    </definition>
>
>    <definition name=".tiles.index" extends=".tiles.basePage">
>        <put name="pageName" value="index"/>
>        <put name="additionalHead" value="/pages/indexHead.jsp" />
>        <put name="body" value="/pages/indexBody.jsp"/>
>    </definition>
>
> In the first definition, I have a footer attribute I am using.  However,
> inside the /pages/indexBody.jsp of the second definition (which 
> extends the
> first) I want to do a <tiles:insert attribute="footer"/>  It is 
> complaining
> that it can't find it.

First of all you can <put> attributes only in the first level. See this
thread:
http://www.mail-archive.com/user%40struts.apache.org/msg51618.html
Anyway, why don't you put <tiles:insert attribute="footer" /> in your
basePage.jsp?

Ciao
Antonio



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


[tiles] Re: Tiles "put" page using tiles:insert

Posted by Antonio Petrelli <ap...@apache.org>.
Irv Salisbury ha scritto:
> First, is this the appropriate list for tiles questions?  If not, 
> sorry, and
> can someone tell me a better one...

Yes it is! But just a note: next time put a "[tiles]" prefix in your 
subject field.

> I have the following two defintions in my tiles-def.xml file:
>
>    <definition name=".tiles.basePage" path="/pages/tiles/basePage.jsp">
>            <put name="additionalHead" value="/pages/tiles/empty.jsp" />
>            <put name="body"   value="/pages/tiles/empty.jsp" />
>            <put name="footer"   value="/pages/tiles/footer.jsp" />
>            <put name="pageName" value="This will be your page name"/>
>    </definition>
>
>    <definition name=".tiles.index" extends=".tiles.basePage">
>        <put name="pageName" value="index"/>
>        <put name="additionalHead" value="/pages/indexHead.jsp" />
>        <put name="body" value="/pages/indexBody.jsp"/>
>    </definition>
>
> In the first definition, I have a footer attribute I am using.  However,
> inside the /pages/indexBody.jsp of the second definition (which 
> extends the
> first) I want to do a <tiles:insert attribute="footer"/>  It is 
> complaining
> that it can't find it.

First of all you can <put> attributes only in the first level. See this 
thread:
http://www.mail-archive.com/user%40struts.apache.org/msg51618.html
Anyway, why don't you put <tiles:insert attribute="footer" /> in your 
basePage.jsp?

Ciao
Antonio


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