• 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

Maintaining form data across pages

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to setup a series of jsp pages (jsp1, jsp2, jsp3). Each of these adds or modifies properties (or collections) of object customerForm(supply name/address, add contacts, etc.) This is an "experimental" app I'm putting together to try out struts.
In struts-config.xml, I have the choice of setting the scope parameter for each action mapping. If I set scope to "request", then customerForm is instantiated each time the form is presented - data is lost across forms.

If I set to "session" then I can maintain the data across the various forms, but customerForm.reset() is still called.

My questions:
What is the best way to maintain the customer data across several jsp pages?
Should I just move form data to a customer bean from customerForm each time?
Should I just display data from the current customer bean rather than from customerForm?

Can anyone please help me out?
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In a "wizard" type workflow, I've found that putting the ActionForm in the session works well for me. Just make sure you remove it from the session when you're through with it.

Here is a link that will give you some more ideas about how to set up this type of workflow.

If I set to "session" then I can maintain the data across the various forms, but customerForm.reset() is still called.



If you have an ActionForm that is being populated across multiple pages, you don't want the reset() method to wipe out all the data in the form . Just don't put anythiing in that method, and create your own myReset() method that you call yourself only when you need to.
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you very much
 
reply
    Bookmark Topic Watch Topic
  • New Topic