File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes use tiles to configure a Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "use tiles to configure a "deep" layout" Watch "use tiles to configure a "deep" layout" New topic

use tiles to configure a "deep" layout

Jan Groth
Ranch Hand

Joined: Feb 03, 2004
Posts: 456

let me start with an example to make my problem / misconception clear:

i have a tiles-config which describes my common page layout

if have a page which assembles my jsp:

works fine. :-)

but say i have a component "userlist.jspf" on admin.jspf, which i want to use sometimes and from multiple places. i want to be able to insert it in my tiles config. or say i want to use admin.jspf in different configurations, sometimes with a userliser (for a super admin), sometimes without (for a normal admin).

i thought i put it like this:

no changes on page.jsp, but i like to insert

somewhere on admin.jspf.

does not work :-( <body_include> is unknown from within admin.jspf

i figured out that each <tiles:insert> creates a new ComponentContext, which is empty if i try to evaluate it from admin.jspf tried a lot with <tiles:importattribute>, but does not work either. :-(

what i'd like to achieve is clear: being able to control my page and all of its sub-components with one central definition. and evaluate it from all the way down the hierachy, not only from the first level (page.jsp).

any help appreaciated,
many thanks,
Dileep Kamath

Joined: Jul 15, 2006
Posts: 19
Try adding this line in common/page.jsp, the page that assembles the tiles:

before the piece of code that inserts the body. Its worked for me, so should be the same for you.
Jan Groth
Ranch Hand

Joined: Feb 03, 2004
Posts: 456
thanks a million so far...

i see the parameter is written into the request, and i am able to dump it. but - stupid me - how am i able to call my appropriate insertion now?

this is in the request:

that's what i'm trying:

That's what I get:

note that the path is mixed up and wrong...

how are you calling / processing it?

many greetings,
Jan Groth
Ranch Hand

Joined: Feb 03, 2004
Posts: 456

works like a charm...

many thanks again,
I agree. Here's the link:
subject: use tiles to configure a "deep" layout
It's not a secret anymore!