You could try something like this:

<tiles-definitions>

  <definition name="BaseDef" path="/BaseDef.jsp">
   <put name="header" value="/header.jsp"/>
   <put name="menu" value="${menu}"/>
   <put name="content" value="${content}"/>
   <put name="footer" value="/footer.jsp"/>
  </definition>

  <definition name="AccountSubSection" extends="BaseDef">
   <put name="content" value="/AccountSubSection.jsp"/>
   <put name="menu" value="/menu.jsp"/>
   <put name="subSectionContent" value="${subSectionContent}"/>
  </definition>

  <definition name="fooBarPageAccount" extends="AccountSubSection">
   <put name="subSectionContent" value="/someAccountPage.jsp"/>
  </definition>

  <definition name="fooBarPageAccount2" extends="AccountSubSection">
   <put name="subSectionContent" value="/someAccountPage2.jsp"/>
  </definition>

</tiles-definitions>

Here you have a 'AccountSubSection' definition that overrides the BaseDef's content with your AccountSubSection layout page AccountSubSection.jsp. Now for every account page you want to go to, you just add 1 more definition that extends AccountSubSection.

And to add customer service you would need 1 CustomServiceSubSection definition (for layout) eg

  <definition name="CustomerServiceSubSection" extends="BaseDef">
   <put name="content" value="/CustomerServiceSubSection.jsp"/>
   <put name="menu" value="/menu.jsp"/>
   <put name="subSectionContent" value="${subSectionContent}"/>
  </definition>

plus a definition per page

  <definition name="cspage1" extends="CustomerServiceSubSection">
   <put name="subSectionContent" value="/cspage2.jsp"/>
  </definition>


Your AccountSubSection.jsp will need to use the <tiles:importAttribute> tag so you can access the attributes.


Rick Reumann wrote:

I'm still stumped even working with extending definitions on how to
accomplish this. A friend in #struts_users was helping as well and his
solution is good, but still seems like a lot of work. I posted the idea
below this post...

On Wed, 2003-09-03 at 17:31, Rick Reumann wrote:

Pardon if this is a real stupid question and has been covered before (I
have looked at some of the docs and didn't see this addressed but I've
been known to easily miss the obvious:).


Imagine you have a site that has a main layout:


COMPANY LOGO DATE MAIN MENU

{II. main content section}

FOOTER


I could easily set up a layout definition for the above (BaseDef). However the problem is each of my sub-sections(II. above) in the application could also possibly have different layouts.

For example, imagine the user goes to the "Accounting" section and the layout of the accounting section has...

ACCOUNTING HEADER
LEFT MENU   {accounting page content}   RIGHT STATIC INFO COLUMN


but maybe the Customer Service section is slightly different...


CUSTOMER SERVICE HEADER
{customer service page content}  RIGHT MENU


<snip>


Ok one idea that I got help with would work a bit like this:

<tiles-definitions>
<definition name="BaseDef" path="/BaseDef.jsp">
<put name="header" value="/header.jsp"/>
<put name="content" value="${content}"/>
<put name="footer" value="/footer.jsp"/>
</definition>


  <definition name="AccountSubSection" path="/AccountSubSection.jsp">
   <put name="menu" value="/menu.jsp"/>
   <put name="accountContent" value="/someAccountPage.jsp"/>
  </definition>

  <definition name="fooBarPageAccount" extends="BaseDef">
   <put name="content" value="AccountSubSection"/>
  </definition>


</tiles-definitions>


The above works ok but it requires two definitions for evey page you
want to go even though the "AccountSubSection" definition is basically
the same with just different accountContent.

I've even tried adding "accountContent" as...

  <definition name="AccountSubSection" path="/AccountSubSection.jsp">
   <put name="menu" value="/menu.jsp"/>
   <put name="accountContent" value="${accountContent}"/>
  </definition>

  <definition name="fooBarPageAccount" extends="BaseDef">
   <put name="content" value="AccountSubSection"/>
   <put name="accountContent" value="/someAccountPage.jsp"/>
  </definition>

but that didn't work. There should be a way this could work without
having to provide two defintions for every page I'd want to go to?



--
Jason Lea


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



Reply via email to