struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ricardo Cortes" <rcor...@boltstaff.com>
Subject RE: Benefits of LookupDispatchAction without parameter nonsense
Date Mon, 26 Apr 2004 13:55:21 GMT
The MappingDispatchAction will also solve some of the maintenance problems I've been experiencing
with my Struts application.  However, since it is not officially released in 1.2 we are stuck
with version 1.1.  Anyone have an idea when 1.2 will be released?
 
Thanks,
Ricardo

	-----Original Message----- 
	From: Riyad Kalla [mailto:rsk@email.arizona.edu] 
	Sent: Fri 4/23/2004 6:45 PM 
	To: Struts Users Mailing List 
	Cc: 
	Subject: Re: Benefits of LookupDispatchAction without parameter nonsense
	
	

	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" <rsk@email.arizona.edu>
	> To: "Struts Users Mailing List" <user@struts.apache.org>
	> 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: user-unsubscribe@struts.apache.org
	> > > For additional commands, e-mail: user-help@struts.apache.org
	> >
	> > ---------------------------------------------------------------------
	> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
	> > For additional commands, e-mail: user-help@struts.apache.org
	>
	> ---------------------------------------------------------------------
	> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
	> For additional commands, e-mail: user-help@struts.apache.org
	
	---------------------------------------------------------------------
	To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
	For additional commands, e-mail: user-help@struts.apache.org
	
	
	



Mime
View raw message