• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Struts Tiles Inheritance problem

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!

tiles.xml


mainLayout.jsp



profile.jsp

 
Todd Nine
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

Thanks,
Todd
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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" />

And the error doesn't show up.

Regards,
Herman.
 
They worship nothing. They say it's because nothing is worth fighting for. Like this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic