Return-Path: Delivered-To: apmail-struts-user-archive@www.apache.org Received: (qmail 84072 invoked from network); 18 Jan 2006 02:03:09 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 18 Jan 2006 02:03:09 -0000 Received: (qmail 45808 invoked by uid 500); 18 Jan 2006 02:02:58 -0000 Delivered-To: apmail-struts-user-archive@struts.apache.org Received: (qmail 45785 invoked by uid 500); 18 Jan 2006 02:02:58 -0000 Mailing-List: contact user-help@struts.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Struts Users Mailing List" Reply-To: "Struts Users Mailing List" Delivered-To: mailing list user@struts.apache.org Received: (qmail 45774 invoked by uid 99); 18 Jan 2006 02:02:58 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 17 Jan 2006 18:02:58 -0800 X-ASF-Spam-Status: No, hits=1.4 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (asf.osuosl.org: 65.32.5.134 is neither permitted nor denied by domain of rickcr@gmail.com) Received: from [65.32.5.134] (HELO ms-smtp-04.tampabay.rr.com) (65.32.5.134) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 17 Jan 2006 18:02:57 -0800 Received: from [192.168.0.12] (6532210hfc164.tampabay.res.rr.com [65.32.210.164]) by ms-smtp-04.tampabay.rr.com (8.13.4/8.13.4) with ESMTP id k0I22Zrq003874 for ; Tue, 17 Jan 2006 21:02:35 -0500 (EST) Message-ID: <43CDA1CB.701@gmail.com> Date: Tue, 17 Jan 2006 21:02:51 -0500 From: Rick Reumann User-Agent: Thunderbird 1.4 (Windows/20050908) MIME-Version: 1.0 To: Struts Users Mailing List Subject: Re: Best practices questions References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Symantec AntiVirus Scan Engine X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N 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: user-unsubscribe@struts.apache.org For additional commands, e-mail: user-help@struts.apache.org