• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

multiple form related (wizard)

 
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there,
I'm trying to find some example on internet regarding have multiple forms related between eachother, something like a wizard, where the user submit his data first and than other details on a second page.

What I'm trying to figure out, is a way to pass the all data to my action class only when the last form has been validated.
I found something regarding validation and an attribute called "page" and another artcle about nested tags.

What's the best approach?

Thanks in advance
 
Ranch Hand
Posts: 181
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can use multiple forms in session scope. On each page you submit to the action that loads the next page and the data is saved in the session. After the final action, you can manually validate the contents of the forms.

If you want to aviod session scope, you can create 1 form (using request scope and used in all of the wizard actions) that is a superset of all of the forms that you would put in session using the above method. Then, on each sucessive page of the wizard, use hidden fields to retain all of the data that has already been entered.

I try not to put anything unnecessary in session, so I would use the second method.
 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks a lot it was of great help
 
Alessandro Ilardo
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Once the first step is submit the request get to the ActionForward and send it back to the second step (the one which should have some hidden fields prepolutated).

Would you give an example on how to retrieve a single field with taglibs?
Thanks for your help.
 
Alessandro Ilardo
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm trying to achieve what mentioned here above, but it doesn't work leaving the hidden tags like

<nested:hidden property="email" />

I'm trying to retain data in this way, but it doesn't work either



17:32:27,681 ERROR [InsertTag] ServletException in '/WEB-INF/jsp/registration/partner/step2.jsp': userDataForm
org.apache.jasper.JasperException: Exception in JSP: /WEB-INF/jsp/registration/partner/step2.jsp:44

42
43:
44: <jsp:useBean id="prevForm" scope="request" type="org.apache.struts.action.ActionForm" beanName="userDataForm" />
45:
46: <nested:hidden property="username" value="${prevForm.username}" />



Can anyone show me how to retain the value from the previous form?

[ May 24, 2007: Message edited by: Alessandro Ilardo ]
[ May 24, 2007: Message edited by: Alessandro Ilardo ]
 
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Using the same form and using normal hidden field
<html:hidden property="page" value="2" />
<html:hidden property="product" />
<html:hidden property="DDPlan" />
<html:hidden property="email" />
 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually, there are some open source projects that can probably do this for you (if you haven't already completed it). If you have any sort of semi-complex wizard, you should check out

http://wiki.java.net/bin/view/Projects/EasyWizard

I've used this one for a project and worked pretty seamlessly.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic