Everyone thank you for the feedback, actually I tried the MappingDispatch and 
it seems to be just what I was looking for. You specify the method name IN 
the parameter... so you can set say 3 actions, with different paths, all 
pointing to the same type, and you specify the method to call in the param:

<action
        param="createUser"
        path="/action/createUser"
        type="org.UserAction"/>

<action
        param="updateUser"
        path="/action/updateUser"
        type="org.UserAction"/>

<action
        param="deleteUser"
        path="/action/deleteUser"
        type="org.UserAction"/>

Pretty slick... its not in 1.1 so I have to use nightly :(

On Friday 23 April 2004 03:39 pm, Niall Pemberton wrote:
> Don't you still have to set the "parameter" using the MappingDispatchAction
> class?
>
> One way to do what you want (i.e. not specify the parameter) is to create
> your own custom ActionMapping and override the getParameter() method with
> some logic to look at the path and return the parameter based on it.
> Something like:
>
> public class ParameterActionMapping extends ActionMapping {
>
>    public String getParameter() {
>
>           if (path.endsWith("Create"))
>              return "create";
>
>           if (path.endsWith("Read"))
>              return "read";
>
>           if (path.endsWith("Update"))
>              return "update";
>
>           if (path.endsWith("Delete"))
>              return "delete";
>
>           return super.getParameter();
>
>    }
> }
>
>
> Then in struts-config.xml you can use this mapping for all your actions by
> setting the type:
>
>      <action-mappings type="myPackage.ParameterActionMapping">
>
> or on indivdual actions using the className
>
>       <action className="myPackage.ParameterActionMapping" ...
>
> Niall
>
> ----- Original Message -----
> From: "Riyad Kalla" <[EMAIL PROTECTED]>
> To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Sent: Friday, April 23, 2004 11:08 PM
> Subject: Re: Benefits of LookupDispatchAction without parameter nonsense
>
> > Hrrm.. I just found MappingDispatchAction and that seems to be exactly
>
> what I
>
> > was looking for... has anyone used this class?
> >
> > On Friday 23 April 2004 03:00 pm, Riyad Kalla wrote:
> > > Hey guys,
> > > After playing with the LookupDispatchAction most of the day and
>
> converting
>
> > > over some existing functionality to using it, I've figured out that i
>
> love
>
> > > the consolidation of functionality into 1 class, but the problems I've
>
> run
>
> > > into (non stop) dealing with the parameter and making sure that all my
> > > buttons now have "property" values (which, for example, breaks some
> > > existing code like <html:cancel />) so that the LDA has a parameter to
> > > determine which method to call has gotten me really short on nerves.
> > >
> > > Does anyone else have a nice clean way that they have consolidated all
> > > their CRUD functions into a 1 action, then found a nice way to delegate
>
> to
>
> > > the proper method based on say the URL that the user is trying to
> > > access (instead of the parameter value)?
> > >
> > > Best,
> > > Riyad
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

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

Reply via email to