This is possible - on my site I have an option - the user can select a
simple template or one with a portal look and feel.  Down the right side of
the page on the portal view are a series of tiles each of which stands on
its own, in other words they are independent of the page being displayed.
That is important since they could be on any page.  In your case it sounds
like you know where each of the tiles will be and maybe the action rendering
the page can also provide any data for the portlets.

The technique I use is a version (simpler) of the one Cedric describes in
the advanced Tiles paper
(http://www.lifl.fr/~dumoulin/tiles/tilesAdvancedFeatures.pdf ).  It has
also remained unchanged for over a year so there may be a better way to do
this.  First the Tiles def sets up the template and the list.  Then each of
the portlets is defined - the controllerURL is an action that is fired prior
to the tile being rendered so you can load up the What's New items into
request scope.


  <definition   name="portal.body.pagedef"
                                path="/web/pages/portal/PortalBody.jsp">
        <put name="numCols" value="1"/>
        <putList name="list0">
                <add value="portal.whatsnew.pagedef"/>
                <add value="portal.newpictures.pagedef"/>
                <add value="portal.popularpictures.pagedef"/>
                <add value="portal.popularpages.pagedef"/>
        </putList>

<definition     name="portal.whatsnew.pagedef"
                                controllerUrl="/do/portalWhatsNew"
                                path="/web/pages/portal/PortalWhatsNew.jsp"/>

  <definition   name="portal.newpictures.pagedef"
                                controllerUrl="/do/portalNewPictures"
                                path="/web/pages/portal/PortalNewPictures.jsp"/>

  <definition   name="portal.popularpictures.pagedef"
                                controllerUrl="/do/portalPopularPictures"
                                path="/web/pages/portal/PortalPopularPictures.jsp"/>

  <definition   name="portal.popularpages.pagedef"
                                controllerUrl="/do/portalPopularPages"
                                path="/web/pages/portal/PortalPopularPages.jsp"/>

These examples include the capability to have a variable number of columns -
since you only want one column you can eliminate the vboxLayout.jsp. The
HTML is the PortalBody.jsp looks like this:


<table width="135" border="1" cellspacing="0" cellpadding="0">
<tr>
<%
int numCols = Integer.parseInt(numColsStr);
ComponentContext context = ComponentContext.getContext( request );
for( int i=0; i<numCols; i++ )
  {
  java.util.List list=(java.util.List)context.getAttribute( "list" + i );
  pageContext.setAttribute("list", list );
  if(list==null)
    System.out.println( "list is null for " + i  );
%>
<td valign="top">
  <tiles:insert page="/web/pages/portal/vboxLayout.jsp" flush="true" >
    <tiles:put name="list" beanName="list" beanScope="page" />
  </tiles:insert>
</td>
<%
  } // end loop
%>
</tr>
</table>


Then the vboxLayout.jsp looks like this:


<tiles:useAttribute id="list" name="list" classname="java.util.List" />

<%-- Iterate over names.
  We don't use <iterate> tag because it doesn't allow insert (in JSP1.1)
 --%>
<%
Iterator i=list.iterator();
while( i.hasNext() )
  {
  String name= (String)i.next();
%>
<table width="135" border="1" cellspacing="0" cellpadding="0">
<tr><td>
<tiles:insert name="<%=name%>" flush="true" />

</td></tr>
<tr><td><hr/></td></tr>
</table>
<%
  } // end loop
%>


PortalBody.jsp is the content for another template defining the header,
footer, etc..


  <definition name="home.pagedef"       extends="layouts.pagedef" >
          <put name="title"                                     value="home.title" />
          <put name="header"                            
value="/web/includes/header.jsp" />
          <put name="index"                             
value="/web/pages/home/HomeIndex.jsp" />
          <put name="content"                           
value="/web/pages/home/HomeContent.jsp" />
          <put name="footer"                            
value="/web/includes/footer.jsp" />
          <put name="styleSheet"                        
value="web/styles/Grey_StyleSheet.css" />

   <put name="rightIndex" value="portal.body.pagedef"/>
  </definition>


If your tiles on the right are different for each page then this is probably
overkill - I like to make the portlets independent so they could appear on
any page.

Cal
www.calandva.com

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
Behalf Of Paul-J Woodward
Sent: Monday, December 08, 2003 2:08 PM
To: Struts Users Mailing List
Subject: iterate over a list of tiles

Dear all,

I would like to have a tile which contains a sequence of other tiles, the
definition of which comes from a putList.

Put into context, the right hand bar of all pages is a sequence of
'snippets' which are different for each page. I'd like to create a putlist
for each page and place it in the tiles.xml file and then have a single
template tile to insert them.

Any ideas?

Thanks, Paul
------------------------------------------------------------
Global Equity Derivatives Technology
Deutsche Bank [/]
Office  +44 (0)20 754 55458
Mobile +44 (0)7736 299483
Fax      +44 (0)20 7547 2752
------------------------------------------------------------


--

This e-mail may contain confidential and/or privileged information. If you
are not the intended recipient (or have received this e-mail in error)
please notify the sender immediately and destroy this e-mail. Any
unauthorized copying, disclosure or distribution of the material in this
e-mail is strictly forbidden.



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



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

Reply via email to