Hello Joe, Nothing distasteful, really... it's just that, due Struts, actionForms etc , i have been so used NOT to call request.getParameter() that Now, when I see that code, I don't like it... :-)
Well, I don't like it because I have a suspicion of request-parameter based dispatch -- but that's been the topic of much discussion on past threads; if I had a similar case, I would almost certainly use a dispatch method linked to the ActionMapping and then use JavaScript to dynamically change my form's submit action. But really, it's a matter of taste.
Meanwhile, I don't think there's anything so awful about calling request.getParameter() when you have a request object at hand -- for simple one parameter situations, I often do that, especially if I'm going to use the value as a String anyway -- but again, a matter of taste.
Joe
Regards, marco
-----Original Message----- From: Joe Germuska [mailto:[EMAIL PROTECTED] Sent: 22 April 2005 14:28 To: Marco Mistroni; 'Struts Users Mailing List' Subject: Re: Struts 1.3: retrieving commands dynamically from Action
Marco:
I'm not quite sure what you find distasteful about how dispatch action is working; is it simply that you think the request parameter values are not controlled enough to be good for use as bean names?
Maybe the problem is that you've been caught where the DispatchChainAction class hasn't been fully updated for Struts 1.3 and chain. It was ported in from the struts-chain sandbox implementation, but it was never upgraded to deal with the idea of multiple catalogs.
I had mostly skipped that because I wasn't sure who was using it, and because I have a bit of a sense that a ChainAction is obsolete now that you can specify a command directly on an ActionMapping. Maybe as we talk through your situation, we can work out whether the right solution is to "fix" DispatchChainAction, or to introduce a useful generic Command which does what you want.
If this isn't what bothers you about your current solution, please clarify. If it is what bothers you, we can work out the possible routes.
Joe
At 1:52 PM +0100 4/22/05, Marco Mistroni wrote:Hello all, I am writing a small application using struts 1.3 And commons-chain. Currently, I have defined a BaseAction class which retrieves Commands dynamically based on the path used For example, calling /login will result in the action Retrieving the command called /login String name = mapping.getPath(); System.out.println("Retrieving command for action"+ name); Command command = catalog.getCommand(name);
That works fine (or eventually can be improved, as suggested here http://wiki.apache.org/jakarta-commons/CommonsChainAndSpringFramework
But, what if my action extends DispatchAction?
Best htat I could do was to create a BaseDispatchAction that retrieves The command based on the parameter that triggers Dispatch's action specific method. That results in a code like this :
String name = mapping.getParameter(); String command = request.getParameter(name); Command command = catalog.getCommand(name);
Question: what's the best strategy to use for retrieving commands For a DispatchAction? Are there better (I hope) alternatives?
Any comments are welcome...
Thanx in advance and regards marco
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--
Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com "Narrow minds are weapons made for mass destruction" -The Ex
--------------------------------------------------------------------- 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]
--
Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com "Narrow minds are weapons made for mass destruction" -The Ex
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]