This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Nested Tiles" Watch "Nested Tiles" New topic
Author

Nested Tiles

Simon Joseph Aquilina
Ranch Hand

Joined: Feb 14, 2006
Posts: 102
Hello,

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>

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

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" />
</definition>

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,
sim085
Ningfeng Xu
Greenhorn

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

http://mail-archives.apache.org/mod_mbox/struts-user/200412.mbox/%3C41AE37ED.1060603@gmx.net%3E

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.


SCJP2
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: 102
Hi,

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

regards,
sim085
 
Consider Paul's rocket mass heater.
 
subject: Nested Tiles
 
Similar Threads
HELP with tiles
confusion on struts tile
struts tiles 1.3.8
Tiles in struts?
Nest tiles don't work :(