You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Richard Yumul <rm...@polexis.com> on 2001/04/06 01:53:27 UTC
how to implement multi-page forms with struts?
Hi - I'm working on a web application and trying to implement a multi-page
form (wizard style), with 'Next' & 'Back' buttons on each page to step
forwards & back through the wizard. Is there a 'struts' way of doing this?
Currently, I'm trying it with 1 ActionForm class and 1 Action controller.
Each of the JSP pages is referencing the same action path. Here's the part
of my struts-config.xml file relevant to the wizard:
--------------------------------------------------------------
<!-- FormBean declaration: -->
<form-bean
name="themeForm"
type="ThemeForm"
/>
<!-- Action declaration -->
<action path="/themeWizard"
type="ThemeWizard"
name="themeForm"
scope="session"
validate="false"
input="/createTheme.jsp"
>
<forward name="step1" path="/createTheme.jsp"/>
<forward name="step2" path="/selectAnalyst.jsp"/>
<forward name="step3" path="/selectCommenters.jsp"/>
<forward name="complete" path="/newTheme.jsp"/>
</action>
--------------------------------------------------------------
Then, my JSP's look something like this:
--------------------------------------------------------------
...
<html:form action="/themeWizard.do" method="post">
<input type="submit" name="go" value="< Back">
<input type="hidden" name="page" value="2">
<input type="submit" name="go" value="Next >">
</html:form>
...
--------------------------------------------------------------
Each jsp has pretty much the same format, w/ the hidden parameter 'page' set
to whatever step the page is in the wizard. I use that in the Action class
to discern to which page I should forward the browser.
Am I doing something fundamentally wrong, or am I even close - maybe just
missing an attribute somewhere? Or do I have to declare a separate action
in the struts-config.xml file for each page in the wizard?
Thanks,
Rich Yumul
Richard M. Yumul
Polexis, Inc.
Direct: 619-542-7209
Fax: 619-542-8675
http://www.polexis.com
transforming data into knowledge