I'm having issues with inheritance using tiles. I have a main page layout containing 4 tiles: header footer menu body
This works fine, the problem comes when I try to insert tiles in the jsp that is the body portion of my page. I have 3 reusable tiles:
listusers.jsp listroles.jsp listgroups.jsp
I insert the listroles.jsp and the listgroups.jsp tiles in my profile.jsp page. The profile.jsp is the body tile of the main.layout tile. When I attempt to do this I get the following error.
When I debug struts, I notice that when is called, the current context contains null attributes. Given this I feel that it is a scope issue, since the profile.jsp is within a given layout. However, I don't know how to fix this, can anyone give me a hand? Below is my tiles.xml file, and my mainlayout.jsp, and profile.jsp. Thanks!
Does anyone out there have any ideas? I'm getting very frustrated, I'm sure this is quite simple, but the documentation is nill on this setup. It only supports tiles 1 level deep from the root tile, surely this can recurse on a tree to a descendant of a tile, or can it only recurse to the child?
Hi, I'm new with Tiles too, but I think I can help you.
You are trying to use tiles in a tile file. That's not the idea. The tiles must be inserted into layouts. The layout is the model, with some holes where you put the tiles.
In your layout you can use <tiles:get...> to get the content of a tile. But you can't use that tag to insert content into another tile (profile.jsp). This means that tiles must be independent of each other.
The only ones that depends on them are the layouts. You cannot have a layout into another layout. Remember it.
If there is a tile that you don't want to use in a layout, you can set that property to blank and configure it to not show an error with something like this:
In the definition: <put name="extra.component" value=""/>
In the layout: <tiles:insert attribute="extra.component" ignore="true" />