wood burning stoves 2.0*
The moose likes Struts and the fly likes Multipage Form implementation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Multipage Form implementation" Watch "Multipage Form implementation" New topic
Author

Multipage Form implementation

lavi mendonca
Ranch Hand

Joined: Apr 24, 2002
Posts: 53
Hi,

I am using Struts 1.1.
I need to implement a multipage form for my functionality which caters to add and modify. I need to use the same jsps, ActionForm and Action class to handle add as well as modify. On each page/ form, there will be a set of fields which the user will need to fill. Only on the last page (say 5th page) after final submit, the data (collected from each page) has to be either added or updated as appropriate in the database. I am able to handle validation in my ActionForm for each page submit.
My question is

1. Other than implementing this by setting scope = session in action mapping of struts-config xml or passing fields of each page into the next subsequent page (via hidden fields), is there any other way of implementing this ?? Can i still retain the form data through subsequent pages ??

Thanks in advance,
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Originally posted by lavi per:
Other than implementing this by setting scope = session in action mapping of struts-config xml or passing fields of each page into the next subsequent page (via hidden fields), is there any other way of implementing this ??

Either of these methods will accomplish what you want, and these are the best two methods that I can think of. Why do you need another way to do it?


Merrill
Consultant, Sima Solutions
lavi mendonca
Ranch Hand

Joined: Apr 24, 2002
Posts: 53
Hi Merrill,

Thank you for your response. Its been decided not to use session since its already overused in the project and they don't way to further overburden it. The other option could be via html hidden fields, but this would be an unclean way of doing it as well as cause maintainability issues. I was wondering if there is another approach to handling multi-page form data, such that i am able to access fields corresponding to the first page even on subsequent pages as well as the final page which finally adds the data in the database.

Thanks again,
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
There's no magic bullet. Either deal with the messiness of hidden fields or use the HTTPSession. In my experience, as long as you clean up after yourself (Meaning remove objects from the session when you're done with them) using the HTTPSession isn't really a big performance problem, especially with today's App Servers. The only exception to this is if you're working on a site that expects thousands of users per minute.
lavi mendonca
Ranch Hand

Joined: Apr 24, 2002
Posts: 53
Thanks Merrill once again for your help and inputs. We have decided to go ahead and use session scope for the multipage form bean in struts-config (action tag).

Thank You !!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Multipage Form implementation
 
Similar Threads
Struts 1.1: Help needed with html:select, html:options, html:optionsCollection
setIndexedProperty errors after reposting form data
mulitpage form in struts
Summary of Struts, by Struts newbie
struts 2 posting large data