I am using Struts tiles 1 succesfully, however I have come across a problem when trying to nest tiles.
I currently have a layout like so:
I wish to have another template like this, for use in quite a few user pages:
So I wish to extend the first layout for the user layout. In the tiles definiton I am using:
<definition name=".basic.layout" path="/WEB-INF/jsps/basicLayout.jsp">
....
<definition name=".user.layout" extends=".basic.layout">
<put name="content" value="/WEB-INF/jsps/user/layout.jsp"/>
....
<definition name=".user.page" extends=".user.layout">
<put name="userContent" value="/WEB-INF/jsps/user/page.jsp"/>
....
In user/layout.jsp
I attempt to show the tile usually, using <tiles:get name="userContent"/>
.
And the problem is The requested resource (/WEB-INF/jsps/user/userContent) is not available
I found some information from here
This solution worked for me.
In this case, usually you have to create a new definition extending from an existing one, fill the attribute in the correct template and assign the new definition as an attribute to the main template.
In other words:
<definition name="product.nav" template="/productNavLayout.jsp">
<put-attribute name="productPathNav" value="/productPathNav.jsp" />
<put-attribute name="productNav" value="/productNav.jsp" />
</definition>
<definition name="product.nav.extended" extends="product.nav">
<put-attribute name="productContent" value="product.grid" />
</definition>
<definition name="page.products" extends="layout">
<put-attribute name="content" value="product.nav.extended" />
</definition>