> -----Original Message-----
> From: PILGRIM, Peter, FM 
> 
> 
> > -----Original Message-----
> > From: Vic Cekvenich [mailto:[EMAIL PROTECTED]
> > 
> > One thing that might help you is this, Tiles 201, that 
> basicaly has a 
> > controler for each tile, with it's own setup, it should 
> give you good 
> > ideas, else repost.
> > http://blogs.browsermedia.com/patrick/index.do?date=20030211#130200
> > 
> 
> --////--
> 
> Actually I do not see how Tiles Controller can help me here.
> 
> I think what I need to is pass an JSP request parameter to the 
> <html:form> in some form or the other.
> 
> If this is my tiles layout file, which I reference from Tile 
> definitions or <tiles:insert page="..." /, then I want the
> action attribute to be set dynamically.
> 
> // file: /tiles/layout.jsp
> <html:form action=<%= 
> pageContext.findAttribute("actionToLaunch") %>" >
>       <tiles:insert attribute="form-header" />
>       <tiles:insert attribute="tab-navigation" />
>       ...
> </html:form>
> 
> In a JSP I can refer to Tiles Layout
> 
> <tiles:insert page="/tiles/layout.jsp" >
>     <tiles:put name="form-header"  value="form-header.jsp" />
>     <tiles:put name="tab-navigation"  value="navbar.jsp" />
> 
>       <%-- // Some how set the request parameter `actionToLaunch' here
> --%> 
> 
>       ...
> </tiles:insert>
> 
> I think a Tiles Controller is a overkill for such a simple request.
> 

Actually one of the joys of consulting, is that you often get to 
solve a lot of your own questions, because not many other people are 
advanced enough to do it.

The solution is staring me in the face, namely <tiles:useAttribute>

In the JSP I declare a tiles attribute as normal but with a special
runtime attribute

<tiles:insert page="/tiles/layout.jsp" >
        <tiles:put name="form-header"  value="form-header.jsp" />
        <tiles:put name="tab-navigation"  value="navbar.jsp" />

        <%-- ***************************** --%>
        <tiles:put name="form-action-url"
                        value="<%=
request.getContextPath()+"/AnotherAction.do %>" />
        <%-- ***************************** --%>

</tiles:insert>

Now in the layout tiles template. I can simply use the Tiles attribute.

// file: /tiles/layout.jsp

<tiles:useAttribute id="actionToLaunch" name="form-action-url" 
        type="java.lang.String" />

<html:form action="<%= actionToLaunch %>" >
        <tiles:insert attribute="form-header" />
        <tiles:insert attribute="tab-navigation" />

        ...

</html:form>

A single Tile layout that is configurable by a Tiles scope parameter.
And that's all she wrote!

> > 
> > PILGRIM, Peter, FM wrote:
> > > Hi
> > > 
> > > I got a Tiles template design question. I have a web site 
> > like Amazon.com
> > > that 
> > > using Tabs to navigate around a set of HTML Form elements. 
> > Each Page has a 
> > > HTML Form that contain lots of HTML Input elements. I have 
> > written the JSP
> > > in the first phase to be monolithic and now I want to 
> break down the
> > > layout to use Tiles. 
> > > 
> > > I want to take advantage of the fact, that certain areas of 
> > the layout
> > > design are shared. Unfortunately I have run in to 
> > difficulty because 
> > > they want a specific design that forces me to run an 
> > <html:form> outside
> > > all the shareable and non-shareable tiles. 
> > > 
> > > Ideally, I would like to dynamically set the name of the 
> > `action' tag 
> > > of <html:form> below. I would like to say action="/Main.do" 
> > and then 
> > > action="/Shipping.do" for a single template layout. How can 
> > I do this, 
> > > using TILES? Otherwise I will have to create template layouts 
> > > for each tab page. (Yuck)
> > > 
> > > Also is it good practice to have template layout within 
> > templates layout?
> > > 
> > > 
> > > // This is a template layout.jsp
> > > 
> > > <!-- Search form -->
> > > <tiles:insert attribute="customer-search-form" /> 
> > >   <%-- e.g. ``customerSearchPrompt.jsp'' grabs a CRM record 
> > >           from database. This tile is common to all 
> > >           tabbed pages
> > >   --%>
> > > 
> > > <html:form action="..." />
> > > 
> > >      <!-- Order Type and Id -->
> > >      <tiles:insert attribute="form-header" />     
> > >   <%-- e.g. `sectionHeaderType.jsp' common to all tabs --%>
> > >      
> > >      <!-- Core Tab Navigation -->
> > >      <tiles:insert attribute="tab-navigation" />          
> > >   <%-- e.g. `tabNavigation.jsp' common to all tabs -->
> > >      
> > >      <!-- Form area -->
> > >      <tiles:insert attribute="form-content" />    
> > >   <%-- e.g.``MainTab.jsp'', ``ShippingTab.jsp'' 
> > >           this is the heart of the form entry area.
> > >           This tile will change from tab page to tab page.
> > >   --%>
> > >      
> > >      <!-- Form action -->
> > >      <tiles:insert attribute="form-action" />     
> > >   <%-- e.g. `MainActions.jsp'', ``ShippingActions.jsp''
> > >           Each tab page shares a set of common buttons, 
> > >           but has it possible for a tab page to have its
> > >           own custom buttons.
> > >           This tile will change from tab page to tab page.
> > >   --%>
> > > 
> > > </html:form>
> > > 
> > > Any ideas appreciated, MTIA
> 
> --////--



--
Peter Pilgrim,
Struts/J2EE Consultant, RBoS FM, Risk IT
Tel: +44 (0)207-375-4923


********************************************************************
      Visit our Internet site at http://www.rbsmarkets.com

This e-mail is intended only for the addressee named above.
As this e-mail may contain confidential or privileged information,
if you are not the named addressee, you are not authorised to
retain, read, copy or disseminate this message or any part of it.
The Royal Bank of Scotland plc is registered in Scotland No 90312
Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB
Regulated by the Financial Services Authority
********************************************************************

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

Reply via email to