Return-Path: Delivered-To: apmail-struts-user-archive@www.apache.org Received: (qmail 94605 invoked from network); 16 Apr 2008 13:22:53 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 16 Apr 2008 13:22:53 -0000 Received: (qmail 13775 invoked by uid 500); 16 Apr 2008 13:22:37 -0000 Delivered-To: apmail-struts-user-archive@struts.apache.org Received: (qmail 13747 invoked by uid 500); 16 Apr 2008 13:22:37 -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 13730 invoked by uid 99); 16 Apr 2008 13:22:37 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 16 Apr 2008 06:22:37 -0700 X-ASF-Spam-Status: No, hits=-2.0 required=10.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [134.174.159.105] (HELO genome.med.harvard.edu) (134.174.159.105) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 16 Apr 2008 13:21:46 +0000 Received: from BPFDESKTOP2 [10.200.13.162] by genome.med.harvard.edu with ESMTP (SMTPD-9.23) id AD7E0B3C; Wed, 16 Apr 2008 09:22:06 -0400 From: "Michael Gagnon" To: Subject: Advantage of prepare()? Date: Wed, 16 Apr 2008 09:22:03 -0400 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0197_01C89FA3.553D1050" X-Mailer: Microsoft Office Outlook, Build 11.0.5510 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198 Thread-Index: AcifxNvQTsQNJN3LRaCaNvegyHutXg== Message-Id: <200804160922623.SM05580@BPFDESKTOP2> X-Virus-Checked: Checked by ClamAV on apache.org ------=_NextPart_000_0197_01C89FA3.553D1050 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit I've been working with struts2 for about 2 months and so far I've been using the preparable interface to populate any data the resulting page wants to display. I've used the execute method to do non-visible work and determine a result (which controls flow). I'm wondering if this is the intended pattern. If so (and even if not), why? The only intended benefit I see to using prepare at all is if you somehow want to use one action in two different contexts - one which uses the preparable interceptor and one which doesn't. If this was ever the case, I'd argue two different actions should exist. If there's some common functionality needed it should be in a superclass and the subclasses should call into it in the execute method. So given the only appropriate scenario I can think of off the top of my head, its use looks like an anti-pattern to me. I see prepare being used in the way I'm using it in many tutorials but I haven't found any articles explaining any particular reason why. I'm hoping maybe somebody can shed some light on this. should I bother using prepare at all? Why? ------=_NextPart_000_0197_01C89FA3.553D1050--