Return-Path: Delivered-To: apmail-jakarta-struts-user-archive@www.apache.org Received: (qmail 25057 invoked from network); 21 Sep 2003 13:43:59 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 21 Sep 2003 13:43:59 -0000 Received: (qmail 67600 invoked by uid 500); 21 Sep 2003 13:43:34 -0000 Delivered-To: apmail-jakarta-struts-user-archive@jakarta.apache.org Received: (qmail 67583 invoked by uid 500); 21 Sep 2003 13:43:33 -0000 Mailing-List: contact struts-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Struts Users Mailing List" Reply-To: "Struts Users Mailing List" Delivered-To: mailing list struts-user@jakarta.apache.org Received: (qmail 67567 invoked from network); 21 Sep 2003 13:43:33 -0000 Received: from unknown (HELO mxout2.netvision.net.il) (194.90.9.21) by daedalus.apache.org with SMTP; 21 Sep 2003 13:43:33 -0000 Received: from Erez ([212.235.74.63]) by mxout2.netvision.net.il (iPlanet Messaging Server 5.2 HotFix 1.14 (built Mar 18 2003)) with ESMTP id <0HLK00I1VEP4U1@mxout2.netvision.net.il> for struts-user@jakarta.apache.org; Sun, 21 Sep 2003 15:58:24 +0300 (IDT) Date: Sun, 21 Sep 2003 15:58:25 +0200 From: Erez Efrati Subject: Wizard pages in Struts design question To: 'Struts Users Mailing List' Message-id: <02ac01c38048$70179460$050aa8c0@Erez> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Mailer: Microsoft Outlook, Build 10.0.2627 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Importance: Normal X-Priority: 3 (Normal) X-MSMail-priority: Normal X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N I read the HowTo write a wizard on the Struts web-site but I wasn't really happy with the solution, and I am looking for a better one. I came up with another way and I would appreciate your comments. The design consists of: - The 'form' is a session scope form - WizardAction class (a DispatchAction based) with following methods: * init () - starting the wizard and redirect to the first page * finish () - (or save()) finish the wizard and save the information in the form using some business logic delegate. - Each Page or step in the wizard is a separate Action class, extending a WizrardBaseAction (a DispatchAction based) which contains some shared methods. For example: Page1Action extends WizardBaseAction { // initializes the page (done only on first encounter) ActionForward init (mapping,...) throws Exception; ActionForward back (mapping,...) throws Exception; ActionForward next (mapping,...) throws Exception; ActionForward finish (mapping,...) throws Exception; } - Each page/step has a separate action-mapping item in the configuration with local forwards for : 'back' (if not the first page), 'next', 'finish' (if allowed from that page). I apologize for not sketching the whole idea down to the last bit but I hope you get the picture. Only problem is that this design touches the question of chaining actions verses forward redirection (not just dispatching). For example the Page1Action.next() does the following: 1. validate the page 2. perform whatever processing required 3. return the next action to forward to (redirect or chain with all its illness..) In my opinion (humble one of course :) having such a separation keeping each step in its own class is better and clearer design than having them all in the same Action class. Isn't there a way to prevent the reset + pre-population of the form done while chaining actions? Furthermore, is it so bad to redirect between actions? Thanks in advance, Erez --------------------------------------------------------------------- To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: struts-user-help@jakarta.apache.org