Hi Jon,

  Sorry for this very long delay. I was abroad 1 week, and after that have more than
3000 mails to check ! Your mail haven't been catched by my filters, so it was in the
long list of awaiting mails ;-(

  See intermixed for answer.

    Cedric

Jon Ferguson wrote:

> Hi Cedric,
>
> I'm trying to fit this in the context of struts' MVClike framework...  Say I
> wanted to re-write the Invoice example such that I not only associated the
> billing/shipping address information with a tile but also wanted to separate out
> the logic so that my 'addressController' would have the responsibility of
> populating the appropriate address in InvoiceForm rather than pushing that
> responsibility into the editInvoice Action.  Is that feasible?
>

Yes it is. Use BeanUtils method to populate your bean. But, be aware that tiles'
controller is called only when the associated tiles is encountered/rendered. This can
lead to problems when you use a same bean in several tiles in the same page (bean is
not populated as expected).

>
> Then Struts updates the InvoiceForm Action Form from editInvoice.jsp... but
> editInvoice would effectively ignore populating addresses choosing rather to allow
> the address controller to do that work...  I'm not totally sure if this would
> result in a clean implementation but am working on the assumption that it would be
> useful to be able to drop tiles in where desired or even swap out tiles with ones
> that display the data differently.. and do the same with their respective
> controllers.
>

Its an interesting behavior. Have you dig further in your experiment ?

>
> So as a rather poor example: if my invoice has several addresses and the concept
> of a current address I could drop in the single editor for a app that prefers to
> show only the current address, or drop in a table-based editor for an app that
> wants the ability to edit a set of addresses-- the specific controllers would know
> how to get the data into and out of the appropriate parts of the invoice form and
> underlying database.
>
> Does this make sense??

  Yes ! I have also thing of such behavior, but never have time to experiment ...

>
>
> Cheers,
> Jon
>
> Cedric Dumoulin wrote:
>
> >   Hello,
> >
> >   Tiles support controller for each individual Tile.
> >   This controller's role is to prepare data to be rendered by the tile.
> >   Syntax is as follow :
> >
> >  <definition name="examples.rssChannel.offline.body"
> > path="/examples/tiles/rssChannels.jsp"
> >      controllerUrl="/examples/controller/rssChannel.do" >
> >   ..
> >   or
> >
> >  <definition name="examples.rssChannel.offline.body"
> > path="/examples/tiles/rssChannels.jsp"
> >      controllerClass="a.class.Name" >
> >
> >   You can find an example of use in tiles-doc.war or struts-tiles.war :
> >
> >    *   /examples/rssChannels.jsp
> >    *   / test/testController.jsp
> >
> >   More documentation is needed ;-(
> >
> >   Cedric
> >
> > Jon Ferguson wrote:
> >
> > > Hey guys,
> > >
> > > I read in the tiles doc that you can associate a controller with each tile.
> > > However, I cannot find an example of how this is done.
> > >
> > > Any pointers?
> > >
> > > Thanks in advance,
> > > Jon
> > >
> > >   ------------------------------------------------------------------------
> > > --
> > > To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> > > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> >
> > --
> > To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>   ------------------------------------------------------------------------
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>


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

Reply via email to