Thanks, Ted. Spot on. -----Original Message----- From: husted Sent: 07 February 2002 10:52 To: struts-user Cc: husted Subject: Re: Turbine style multiple method actions
See http://jakarta.apache.org/struts/api-1.0/org/apache/struts/actions/DispatchAction.html Really should mention this in the User Guide someplace =:0) -- Ted Husted, Husted dot Com, Fairport NY USA. -- Java Web Development with Struts. -- Tel +1 585 737-3463. -- Web http://www.husted.com/struts/ [EMAIL PROTECTED] wrote: > > I'm just trying to catch up with what's changed in struts 1.0.1 / 1.1 > from the version I previously used (pre version numbers). Is there a > facility to map a request to different methods / actions based on a > request parameter? > > For example, if the request contains a parameter "function", can I > choose the Action that will be invoked, or alternatively, can I invoke > different methods in the action defined in the form.action URL, based > on some parameter? I realise I can change the URL using javascript on > the html form, but this removes the struts config as the control of app > flow. In my previous apps, we found theat often you end up writing > Action classes similar to: > > myAction(..) extends Action { > > if (null == function) { doView(..) } > else if ("submit".equals(function)) { doSubmit(..) } > else ... > > prepareRequest(req, ..); > return mainPageForward; > } > > etc > > Which makes the action into a type of mini controller. I know this > could be done in a more OO way, but that's not my point, I'd like the > controller to be able to do this in some way. Turbine does this in a > very similar way (though I'm not sure I like their parameter > convention). > > My only issue with doing this in the main ActionServlet is that > partioning of the logic should perhaps be encapsulated better -- though > the XML config file provides a suitable scoping for this information. > > I've not been keeping up with the nightly developments - does the > "multiple applications", stuff allow this kind of thing? > > Ken. -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> Visit our website at http://www.ubswarburg.com This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. This message is provided for informational purposes and should not be construed as a solicitation or offer to buy or sell any securities or related financial instruments. -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>