aspose file tools*
The moose likes Struts and the fly likes Nested Tiles Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Nested Tiles" Watch "Nested Tiles" New topic

Nested Tiles

Simon Joseph Aquilina
Ranch Hand

Joined: Feb 14, 2006
Posts: 99

Basically I am trying to define a tile inside a jsp page which is already being loaded from another tile: I have the following structure of files: main.jsp contains three tile defintions, one for the header, one for the body and one for the footer. In the body I want to load a welcome.jsp page, which will contain a tile that loads the contactus.jsp (note that welcome and contact us have two different action clases and form beans. Following is what I did so far (without success):

I tried doing this however I am getting the following exception:
Servlet.service() for servlet action threw exception
javax.servlet.jsp.JspException: ServletException in '/WEB-INF/tiles/welcome.jsp': Error - Tag Insert : No value found for attribute '.contactus_place'.

Now this is what code I have in my documents. In the main.jsp file I have the following tiles:

<tiles:insert attribute=".header" />
<tiles:insert attribute=".body" />
<tiles:insert attribute=".footer" />

Then in the tile-def.xml file I have the following code:

<definition name=".base" path="/WEB-INF/tiles/main.jsp">
<put name=".header" value="/WEB-INF/tiles/header.jsp" />
<put name=".footer" value="/WEB-INF/tiles/footer.jsp" />

<definition name=".welcome" extends=".base">
<put name=".body" value="/WEB-INF/tiles/welcome.jsp" />

Now till there everything works fine. My problem comes when I try to do the following:

inside the welcome.jsp page I placed this tile attribute:

<tiles:insert attribute=".contact_holder" />

and then in the tile-def.xml file I placed the following code:

<definition name=".contact" extends=".welcome">
<put name=".contact_holder" value="/WEB-INF/tiles/contact.jsp" />

I was thinking that like this when the struts (because of what i did in the struts.config) will run docontact which points at .contact, it will load the welcome page (using the welcome action class) and then load the contact.jsp using the contact action class (which is what I want)

However I recieve the exception I mentioned above. I do not know if my line of tought is correct. However all help is more then welcome.

thanks and regards,
Ningfeng Xu

Joined: Jan 22, 2002
Posts: 18
have you ever looked at this?

it is about nested tile. I was running into same situation as above. However, I decided not to try this, just want to keep my code simple, not being trapped in other possible problems in future.

Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
Where does ".contactus_place" fit in to this? The only place that I see it mentioned is in the error message.

- Brent
Simon Joseph Aquilina
Ranch Hand

Joined: Feb 14, 2006
Posts: 99

I know it is too late to post on this topic. I had solved this problem but never found this post but never found this post to see if anyone had replied. Now I did (from google by mistake.

It is never too late to say thank you

so thanks for both your replyies

I agree. Here's the link:
subject: Nested Tiles
Similar Threads
Nest tiles don't work :(
struts tiles 1.3.8
HELP with tiles
confusion on struts tile
Tiles in struts?