After reading up on it, the DispatchAction setup is what I was referring to when I said "using a token", it definitely looks like the nicest solution, since it saves you a bunch of ugly if-then-else stuff. What will DispatchAction.execute() do if there's no method to handle a particular value for "dispatch" or whatever you call it in your instance? -- "His comrades fought beside him, Van Owen and the rest... But of all the thompson gunners- Roland was the best." Josh McDonald Analyst Programmer Information Technology Ph: 61 7 3006 6460 Email: [EMAIL PROTECTED]
>>> [EMAIL PROTECTED] 18/01/2006 12:02:51 pm >>> Josh McDonald wrote: > First of all, is there a site full of patterns and best practices for > tomcat? For Tomcat specifically? Not sure. > > Second, here's my specific enquiry: Let's say we've a page where you > select an item from a list, and then you can perform one of 5 actions on > it. > > One is 5 forms with different ".do" destinations, and javascript to > copy information from the "master form" into these forms and then submit > them. > > This doesn't really strike me as elegant. Nah, don't do that. You are correct, not elegant. > > However the other solution that immediatly springs to mind is some form > of token (or god forbid an url or class name) describing what action to > call embedded in the form, and set with javascript. Well, I like to use Dispatch actions to keep my related types of functionality in one Action class. To use a Dispatch action you simply pass a parameter to your Action (as defined in your action-mapping) which tells the Action which actual method to call. > The problem with this, is it moves the "which class file to call to do > an action" decision is moved out of the struts-config.xml, into either > the jsp (in the case of the url/class name), or into some "wrapper" > servlet in the case of the token. Not really sure what you mean there since you can simply have different mappings which 'where they actually go to' is defined in the struts-config. I think you need to clarify a bit if we are talking about form submissions with a form tag or clicking on URL. Either way, I still use a DispatchAction to hold related functionality in one Action class. You might want to take a look at a full example that mimics CRUD functionality (create,update,delete) and uses a Dispatch action. http://www.learntechnology.net/struts-crud.do Some functionality in that example is called from an URL others from a form submit. -- Rick --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] *************************************************************************** Messages included in this e-mail and any of its attachments are those of the author unless specifically stated to represent WorkCover Queensland. The contents of this message are to be used for the intended purpose only and are to be kept confidential at all times. This message may contain privileged information directed only to the intended addressee/s. Accidental receipt of this information should be deleted promptly and the sender notified. This e-mail has been scanned by Sophos for known viruses. However, no warranty nor liability is implied in this respect. ****************************************************************************