Craig,

Yes, I am relatively new to Tiles. This is my first major project using it
and we make extensive use of Tiles in our webapp. We also use the <display>
taglib and take advantage of its column sorting support. Sorting of table
data is handled automatically by this taglib using request parameters and it
works fine in our webapp. For example, the default display of our user list
is sorted in ascending order based on the values in the 4th column (zero
based sort offset in example below) of the listing like so:

  /portal/admin/users/list.dbm?order=asc&sort=3

This will trigger the following action mapping in our struts-config.xml
file:

  <action    path="/portal/admin/users/list"
             type="com.verisign.dbms.portal.ListUsersAction">
    <forward name="success"     path="portal.admin.users.list"/>
  </action>

And the following tile definitions are interpreted when the "success"
forward is used:

  <definition name="portal.admin.users.list" extends="portal.admin.users" >
    <put name="menu"   value="portal.menu.admin.users.modify" />
    <put name="body"   value="portal.body.admin.users.list" />
  </definition>

  <definition name="portal.body.admin.users.list"
extends="portal.body.admin.users" >
    <put name="bodyContent" value="/portal/admin/users/list.jsp" />
  </definition>

And the list.jsp usings the <display> taglib tags:

  <display:table width="90%" name="<%=UserMgmtBean.KEY%>"
    property="users" scope="session"
    requestURI='<%=request.getContextPath() +
"/portal/admin/users/list.dbm"%>'>

    ...

  </display:table>

In the layout JSP that ultimately includes the "bodyContent" value above, we
are using:

  <tiles:insert attribute="bodyContent"/>

which is comparable to the example that you suggest I try. So, I can
honestly say that I have tried it and it works. :-)

Without rummaging through the <display> taglib source, the traversal through
action mapping to action with forward to the tile definition that ultimately
displays our master page layout containing the leaf listing JSP is working
to control sorting. So, the request parameters are getting through to the
leaf listing JSP. Otherwise, the <display> tags wouldn't be responding to
the request parameter settings that control how to sort the list contents.

We are working with the version of Tiles integrated in Struts 1.1-b2. Maybe
you are working with a different version of Struts/Tiles. If so, that might
explain why something similar isn't working for you. In any case, it sounds
like you have a workaround for now.

- Van

> -----Original Message-----
> From: Craig Tataryn [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, November 27, 2002 9:59 AM
> To: [EMAIL PROTECTED]
> Subject: Re: Tiles and parameters...
> 
> 
> <sigh>You must be new to Tiles :)  It doesn't seem to work.  
> Try it for
> yourself, make yourself a controller called MyController who's success
> forward, forwards to a tiles template called "tiles.template".
> 
> The tiles template can looks something like this:
> 
> <definition path="mainlayout.jsp" name="tiles.template">
>   <put name="page1"   value="/page1.jsp" />
>   <put name="page2"   value="/page2.jsp"/>
> </definition>
> 
> Your mainlayout.jsp would look something like this:
> 
> <html>
> <body>
> <tiles:insert attribute="page1"/>
> <tiles:insert attribute="page2"/>
> </body>
> </html>
> 
> In page1.jsp put the following:
> 
> <h1><%=request.getParameter("param1")%></h1>
> 
> Call your controller like so: MyController.do?param1=1
> 
> You will get the error: "bean param1 not found within scope".
> 
> However, I found a solution.  In MyController, I simply use
> request.getParameter("param1") and then take that value and 
> place it back in
> using request.setAttribute.  Tiles or Struts does not seem to 
> preserve the
> request parameters from the original call for the Tiles which 
> are being
> forwarded to, so you have to do it manually (which might make sense?).
> 
> Craig.
> 
> P.S. I have read the specs :)
> 
> ----- Original Message -----
> From: "Van Riper, Mike" <[EMAIL PROTECTED]>
> To: "'Craig Tataryn'" <[EMAIL PROTECTED]>;
> <[EMAIL PROTECTED]>
> Sent: Tuesday, November 26, 2002 11:42 AM
> Subject: RE: Tiles and parameters...
> 
> 
> > Unless I'm missing something here, you simply use:
> >
> >   request.getParameter("fieldid");
> >
> > in scriptlet code in any of your leaf JSPs to access this request
> parameter.
> > You can also use  <bean:define> in conjunction with this to 
> define a bean
> at
> > the top of your page for use as a bean reference in other 
> Struts tags
> within
> > your JSP pages. You must be new to JSP development. I 
> recommend taking a
> > look at the JSP spec. In particular, section 2.8 of the JSP 
> 1.1 spec lists
> > the implicit objects available to all JSP pages.
> >
> > Good Luck,
> >   Mike "Van" Riper
> >   mailto:[EMAIL PROTECTED]
> >
> > > -----Original Message-----
> > > From: Craig Tataryn [mailto:[EMAIL PROTECTED]]
> > > Sent: Tuesday, November 26, 2002 5:03 AM
> > > To: [EMAIL PROTECTED]
> > > Subject: Re: Tiles and parameters...
> > >
> > >
> > >
> > > Anyone have any suggestions?
> > >
> > > >From: "Craig Tataryn" <[EMAIL PROTECTED]>
> > > >Reply-To: "Struts Users Mailing List"
> > > <[EMAIL PROTECTED]>
> > > >To: [EMAIL PROTECTED]
> > > >Subject: Tiles and parameters...
> > > >Date: Sun, 24 Nov 2002 00:39:23 -0600
> > > >
> > > >I am using a tiles for a project where I have the 
> following scenario:
> > > >
> > > ><a href="forecast.do?fieldid=1">Forecast for Field 1</a>
> > > >
> > > >The action for forecast.do, simply does some data extraction
> > > and then
> > > >returns a forward to a tiles def which displays this data.
> > > >
> > > >Here is what the existing tiles def looks like:
> > > >
> > > ><definition name="site.forecast" extends="site.introPage">
> > > >   <put name="body"   value="/chart.jsp" />
> > > >   <put name="left"   value="/form/displayChartSummary.jsp"/>
> > > ></definition>
> > > >
> > > >However, each of these jsp pages really should be passed 
> the fieldid
> > > >parameter that the Forecast action was passed.
> > > >
> > > >Is there anyway to get my Forecast action to pass this
> > > fieldid parameter to
> > > >the pages setup in the tiles def it is going to forward to?
> > > Or is there
> > > >any other technique you might suggest as a workaround (don't
> > > particularly
> > > >want to throw things in the session as I want the fieldid to
> > > be at the
> > > >request level so users can see forecasts for different
> > > fields at the same
> > > >time).
> > > >
> > > >Thanks,
> > > >
> > > >Craig.
> > > >Craig W. Tataryn
> > > >Programmer/Analyst
> > > >Compuware
> > > >
> > > >_________________________________________________________________
> > > >MSN 8 with e-mail virus protection service: 2 months FREE*
> > > >http://join.msn.com/?page=features/virus
> > > >
> > > >
> > > >--
> > > >To unsubscribe, e-mail:
> > > ><mailto:[EMAIL PROTECTED]>
> > > >For additional commands, e-mail:
> > > ><mailto:[EMAIL PROTECTED]>
> > >
> > >
> > > Craig W. Tataryn
> > > Programmer/Analyst
> > > Compuware
> > >
> > > _________________________________________________________________
> > > Help STOP SPAM with the new MSN 8 and get 2 months FREE*
> > > http://join.msn.com/?page=features/junkmail
> > >
> > >
> >
> 

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

Reply via email to