You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Cruz, Edward J." <e....@radium.ncsc.mil> on 2003/04/10 16:44:38 UTC

Design Issue wizard type form.

Hi all, 
	
	A little background on what I am trying to accomplish. 
	
	I have a wizard type multipage form to collect data for an order.
The wizard has a total of 4 pages a header section, a add items section, a
shipping information section and a final page to view the whole order before
submitting.  Pages 2-4 must display the information from the previous page
along with the form to collect the information for the current page.  On the
second page, add item, we must redisplay the header information and a form
for an item to be added.  We have a session bean that holds the data on the
business layer as we step through the wizard type form and do not want to
hold the data in the HttpSession.  Therefore, we decided in our action
classes we would create an appropriate model bean with the values needing to
be displayed and put it in the request for the next jsp to display.  This
works fine until we get to a point where the input information of the form
bean fails validation.  Now I need to build this model bean to redisplay the
header information based on the data held in the session bean along with the
redisplayed add item form.  

My question is what is the best way to do this?  

I have come up with two possible solutions: 
1.  Have the validation method of the addItem FormBean forward to another
action that creates the model bean.  However, I have the issue of persisting
the addItem FormBean data to the new request made by the forward.  I also
have the issue of figuring out where the new Action should forward to once
the model is created. 

2. Have the addItem FormBean always return ActionErrors as null or empty and
store the actual errors in another bean in the request scope so that the
Action.execute() method is always called then have logic in the
Action.execute() method to check this other bean to decide if there were
errors in the FormBean validation or not.  
This method has me worried because I am faking out the RequestProcessor by
making it think I always pass validation when in fact I may not. 

Any Ideas?

		
Thanks ahead of time, 
Jamie 
Software Engineering