struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erez Efrati <er...@netmedia.net.il>
Subject Wizard pages in Struts design question
Date Sun, 21 Sep 2003 13:58:25 GMT

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


Mime
View raw message