See intermixed

> -----Original Message-----
> From: Ray Madigan [mailto:[EMAIL PROTECTED]
==////==
> 
> 
> I read the paper
> 
> http://www.browsermedia.com/devcorner/whitepapers/tiles201.jsp
> 
> which explains how to add attributes into a tile of a 
> definition then it
> invokes the page.
> 
> Unfortunatly all I want to do is replace the page that the 
> layout uses to
> render the layout, without the calling page having to care about it.
> 
> Humpf!
> 

This is a limitation of the current released Tiles implementation. 
If I remember rightly, it was slightly disconcerting, to look in 
Ted Husted's books "Struts In Action" and see an example where there 
is a Tiles Definition with $ dollar notation and then read the 
text closer that it cannot never work.
Let say we have a master layout definitions in Tiles.

<definition name=".master.layout" path="/template/class-layout.jsp >
   <put name="header" value="/acme/portal/header.jsp" />
   <put name="body" value="YOU MUST DEFINE THIS!" />
   <put name="footer" value="/sia/portal/footer.jsp" />
</definition>

<definition name=".view.bookList" extends=".master.layout" 
path="/article/book/page.jsp >
   <put name="body" value="/jsp/${skin}/viewBookList.jsp" />
</definition>

This cannot work because Tiles has no information or hooks to handle
special syntaxes.

I think the only way to do this, is with a special Struts or Tiles 
Action class. If we make the value now dynamic then I think you
can get closer to what you want to achieve. 

Here is how I would do this to "skin" an page layout view with a
different look-and-feel

<definition name=".view.bookList" extends=".master.layout" 
path="/article/book/page.jsp > 
   <put name="body" 
value="/ViewInterceptor.do?pageInclude=/jsp/${skin-directory}/viewBookList.jsp" 
/>
</definition>

In other words you write an action `ViewInterceptor' that accepts a 
parameter `pageInclude', which is an URL to the target page in your 
application.
You translate the token ${skin-directory} to whatever is relevant 
e.g a Folder name for skin path. You can any invent an token, tokenising
and semantics you want in the action.

This actions simply request dispatch includes the transformed page URL.
You tell the request processor not to perform action forward by returning
`null' in your action. 

The above works because Tiles is itself performing a request dispatcher include,
so the `ViewInterceptor' is just another level of indirection. The advantage
is you can also set tiles attributes and push them to the request scope
for example. etc etc

It would be better if Struts Tiles had dynamic binding on the values of 
definitions (or components).We could employ the following schemes, then :

        (*) allowed String token substitution
        (*) access to Expression Language evaluator
        (*) had hooks like JSF with it VariableResolver interface. 


> -----Original Message-----
> From: David G. Friedman [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, June 08, 2005 3:36 PM
> To: Struts Users Mailing List
> Subject: RE: [Tiles]
> 
> 
> Ray,
> 
> If Xinsheng [mike] Huang's suggestion about using the JSP ($) 
> dollar sign
> notation doesn't work, I'd suggest looking at giving your 
> template a tiles
> controller so you can set the navi attribute to some object 
> and scope.  That
> way the controller can specify the insert automatically 
> before the tile is
> rendered and without having to put code into every action, 
> just that one
> tile's controller class.
> 
> Regards,
> David
> 
> -----Original Message-----
> From: Ray Madigan [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, June 08, 2005 5:18 PM
> To: Struts Users Mailing List
> Subject: RE: [Tiles]
> 
> 
> I have a fairly simple situation where a set of pages are 
> used throughout
> the application.   Based on a set of crriteria known about 
> the user, I want
> the page to use a set of common tiles to fill some parts of 
> the page, like
> the header of the page.  Other parts of the page are filled 
> with specific
> tiles relative to what the page is attempting to show.  
> Instead of each of
> the pages that use the layout setting the attribute, I 
> thought if it was
> computed in the layout, I would save some management of these entries.
> 
> -----Original Message-----
> From: David G. Friedman [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, June 08, 2005 1:58 PM
> To: Struts Users Mailing List
> Subject: RE: [Tiles]
> 
> 
> Ray,
> 
> What architectural problems prevent you from either using a 
> TilesAction,
> instead of a regular action, or a tiles controller to look 
> those things up
> and set them for you so the page doesn't need to be 'that smart?'
> 
> Regards,
> David
> 
> -----Original Message-----
> From: Ray Madigan [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, June 08, 2005 5:01 PM
> To: Struts Users Mailing List
> Subject: [Tiles]
> 
> 
> I have beat this situation to death without coming up with an answer.
> 
> I want to create a tile layout that includes a composed tile 
> in the layout
> definition.
> 
> Any suggestions would be appreciated
> 
> It needs to look like
> 
>   <table border="0" width="100%" cellspacing="5">
>   <tr><td colspan="2">
>           <tiles:insert attribute="header" />
>       </td>
>   </tr>
> 
>   <tr><td width="140" valign="top">
> **        <tiles:insert page='/src/${Foo.answer}/nav.jsp'/>
> 
> OR        <c:set var='navi' value='/src/${Foo.answer}/nav.jsp'/>
> **        <!-- <c:out value='${navi}'/> outputs the correct page -->
> **        <tiles:insert attribute='navi'/>
> **        <!-- navi is in the wrong scope? ->
>       </td>
>       <td valign="top"  align="left">
>           <tiles:insert attribute='body' />
>       </td>
>   </tr>
> 
>   <tr><td colspan="2">
>           <tiles:insert attribute="footer" />
>       </td>
>   </tr>
> 
>   </table>
> 
==////==

Is this list slow today?

--
Peter Pilgrim
Operations/IT - Credit Suisse First Boston, 
Floor 15, 5 Canada Square, London E14 4QJ, United Kingdom
Tel: +44-(0)207-883-4497

==============================================================================
Please access the attached hyperlink for an important electronic communications 
disclaimer: 

http://www.csfb.com/legal_terms/disclaimer_external_email.shtml

==============================================================================


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

Reply via email to