Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Nested Tiles

 
Simon Joseph Aquilina
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Brent Sterling
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic