Hi everyone, I have a question about nesting layouts with Struts
tiles. I've seen this sort of thing discussed in the past, but in
searching I didn't see an example that I could apply to my situation,
nor did I see a good solution.

Executive summary:

What I want to do is have a simple layout containing two tiles, both
of which are JSP's. However, one of those JSP's is actually another
layout JSP, which itself contains tile placeholders. I can get Struts
Tiles to do the substitutions for the first layout, but it seems to
treat my second layout as a simple JSP and does not do further tiles
substitutions in the second layout.

Detailed description:

We have two separate applications that share a common track bar at the
top of the screen. Beyond that they are completely separate. So, we
have a layout containing "trackbar" and "trackcontent". Trackbar is a
common jsp as you can see below. Trackcontent is simply a blackbox
representing the rest of the app.

  <definition name=".base"         page="/layout/layout.jsp">
    <put      name="trackbar"       value="/common/trackbar.jsp"/> 
  </definition>

Then I made two definitions that put in the appropriate subsititution
for trackcontent. *BUT* note that both of those JSP's have their own
Tiles placeholders called "menu" and "body". It's necessary to do this
because the apps may have different layouts but they must share the
trackbar above.

  <definition name=".app1base"   extends=".base">
    <put      name="trackcontent"       value="/layout/app1Layout.jsp"/>
  </definition>
  
  <definition name=".app2base"   extends=".base">
    <put      name="trackcontent"       value="/layout/app2Layout.jsp"/>
  </definition>

Then, since all the pages of a single app share an app-specific menu,
I made another definition put the right page in for "menu"
  
  <definition name=".app1"   extends=".app1base">
    <put      name="menu"       value="/common/app1NavBar.jsp"/>
  </definition>
  
  <definition name=".app2"   extends=".app2base">
    <put      name="menu"       value="/common/app2NavBar.jsp"/>
  </definition>

Lastly, we have two actual pages that extend the app definitions and
put the right values in for "body"

<definition name="/app1page1.tiles"     extends=".app1">
    <put      name="body"         value="/app1page1.jsp"/>
  </definition>

<definition name="/app2page1.tiles"     extends=".app2">
    <put      name="body"         value="/app2page1.jsp"/>
  </definition>

Now, when I put all this together and point my browser at, say,
app1page1, I get the top-level layout and the trackbar rendered, and
it renders the appropriate trackcontent for app1, but it does NOT do
the second level of substitutions (i.e. substitute the correct menu
and body)

Is Struts capable of doing this sort of two-level layout indirection?
If so, how should I change my tile defs and layouts to make it work.

Thanks a lot!
Dan

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to