(CC'd the mav-user list, 'cause I think this is probably of general
interest)

Sometimes you have commands that require nearly identical controller
behavior, but only slight difference.  If you don't want to create
multiple classes (maybe because it's not an option in your inheritance
graph), you can pass parameters to controllers like this:

  <command name="queryAsc">
    <controller class="org.foo.Query">
      <param name="sortOrder" value="asc"/>
    </controller>
    <view ...
  </command>

  <command name="queryDesc">
    <controller class="org.foo.Query">
      <param name="sortOrder" value="desc"/>
    </controller>
    <view ...
  </command>

The params are available from ControllerContext.getParams(), which is a
new Maverick 2.1 feature.  BTW, one of the default activities of
ThrowawayBean2 is to self-populate with those params.

I use this feature now and then myself, but I would hesitate to build
your entire application that way.  Just my opinion, of course :-)

Jeff Schnitzer
[EMAIL PROTECTED]
It's fun how pretty much anything said on a public list can be quoted in
perpetuity now ;-)

> -----Original Message-----
> From: Tim Colson [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, June 12, 2002 2:49 PM
> To: Jeff Schnitzer
> Subject: RE: Mav params? Part III
> 
> I seem to be having a monologue with myself... and spamming you in the
> process <grin>
> 
> Went on a quest at Mail-archive for mentions of using inner classes
and
> found this thread <grin>
> 
>
http://www.mail-archive.com/struts-user@jakarta.apache.org/msg04283.html
> 
> BTW - we do have the action -> baseaction -> myaction paradigm, and my
> personal aversion to many little files isn't all that strong... in
some
> places it just sorta feels better. ;-)
> 
> Thanks,
> Tim
> 
> 
> 
> > -----Original Message-----
> > From: Tim Colson [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, June 12, 2002 2:38 PM
> > To: '[EMAIL PROTECTED]'
> > Subject: Mav params?
> >
> >
> > Just wondering... in our Struts app, we started out using one
> > action per command... but things got messy quickly. We had
> > say a dozen actions that each had 4 or 5 similar sub-actions.
> >
> > Ex. EditFoo, DeleteFoo, UpdateFoo, SortFoo, MoveFoo, AddFoo, CopyFoo
> >
> > We started using the 'parameter' setting in the
> > struts-config.xml and combined all of the sub-tasks into a
> > single command-like object "CommandFoo".
> >
> > Is there a similar paradigm in Mav?  For example, does the
> > controller class org.foo.Query know the actual command name
> > that fired it?
> >
> >   <commands>
> >     <command name="runQuery">
> >       <controller class="org.foo.Query"/>
> >     <command name="deleteFoo">
> >       <controller class="org.foo.Query"/>
> >
> > Cheers,
> > Tim
> >


_______________________________________________________________

Sponsored by:
ThinkGeek at http://www.ThinkGeek.com/
_______________________________________________
Mav-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mav-user

Reply via email to