I've the next tiles configuration file

<tiles-definitions>
    <definition name="base" template="/includes/layout.jsp">
        <put-attribute name="header" value="/includes/header.jsp" />
        <put-attribute name="menu" value="/includes/menu.jsp" />
        <put-attribute name="footer" value="/includes/footer.jsp" />
    </definition>
    <definition name="home" extends="base">
        <put-attribute name="contentBody" value="/home/view.jsp" />
    </definition>
</tiles-definitions>

and also to display "view.jsp" page I've another page known as "home.jsp" and contains the next code (only)

//home.jsp

<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>
<tiles:insertDefinition name="home" />

and also the problem here's, If i wish to load "edit.jsp" page with same layout, I have to continue doing this part in tiles.xml

<definition name="editbase" extends="base">
            <put-attribute name="contentBody" value="/home/edit.jsp" />
</definition>

and make up a file known as "editbase.jsp" and refer to it as. (repeating the above mentioned code)

I am just wondering is the right way or can one make a move like

<tiles-definitions>
        <definition name="base" template="/includes/layout.jsp">
            <put-attribute name="header" value="/includes/header.jsp" />
            <put-attribute name="menu" value="/includes/menu.jsp" />
            <put-attribute name="footer" value="/includes/footer.jsp" />
        </definition>
        <definition name="home" extends="base">
            <put-attribute name="contentBody" value="/home/view.jsp" />
            <put-attribute name="contentBody" value="/home/edit.jsp" />  
        </definition>
</tiles-definitions> 

and load the page accordingly.. I believe my real question is obvious

I am using apache tiles 2.2.2

thanks ahead of time

cheers

sameera

Unless of course there are many different header/footer/menu, you are able to simplify /includes/layout.jsp have placing the header, footer and menu code directly inside it. Then, use <tiles:insert> to place the particular page content:-

/includes/layout.jsp

<html>
    <head>
        ...
    </head>
    <body>
        <!-- put your header code here -->
        ...

        <!-- put your menu code here -->
        ...

        <tiles:insert attribute="contentBody" />        

        <!-- put your footer code here -->
        ...
    </body>
</html>

tiles-defs.xml

Produce the attribute known as contentBody.

<tiles-definitions>
    <definition name="base" template="/includes/layout.jsp">
        <!-- Create a contentBody with no value -->
        <put name="contentBody" value="" />
    </definition>

    <definition name="view" extends="base">
        <!-- Override base's contentBody -->
        <put name="contentBody" value="/home/view.jsp" />
    </definition>

    <definition name="edit" extends="base">
        <!-- Override base's contentBody -->
        <put name="contentBody" value="/home/edit.jsp" />
    </definition>       
</tiles-definitions>

Your JSP viewer files won't have any tiles tags because putting these tags within the audiences build your layout very rigid and intrusive... this is actually the problem you have now. Rather, put just the actual content within the viewer files. They'll be instantly incorporated by <tiles:insert> in the layout file.

struts-config.xml

If you work with Struts, the meaning title view and edit must match the road inside your struts config, for instance:-

    <action path="/bla" type="..." name="FrmReport" scope="request">
        <!-- path "view" must match tiles definition name -->
        <forward name="success" path="view"></forward>
    </action>

By doing this, Tiles will instantly decorate your page prior to the page will get displayed on screen.