struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erez Efrati <>
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
- 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
			ActionForward init (mapping,...) throws
			ActionForward back (mapping,...) throws
			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 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

Thanks in advance,


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message