File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Scoping of ActionForm Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Scoping of ActionForm" Watch "Scoping of ActionForm" New topic
Author

Scoping of ActionForm

Kinjal Sonpal
Ranch Hand

Joined: Jun 06, 2003
Posts: 96
Hi all,

I have a wizard kind of multipaged form. The user can leave the wizard at any stage and logoff or change section. When he comes back, he's supposed to be presented the same stage,and with all the data so far, including current page.

For this I'm using combination of DispatchAction subclass, single ActionForm with some of the VO being part of the form bean, and the status of the wizard being maintained in the DB.

My Question : What should ideally be the scope of the ActionForm bean? I can easily get my work done by keeping the scope to be session. But should I really be doing this? If not, then what could be the approach to this scenario.

Once the wizard is over, the user logs off, or changes the application section, I use a convenience clean-up method to clean session scope.

Please share your thoughts on this.

Thanks and regards,
Kinjal Sonpal
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

Wizards are usually the only reason for ever using session.

Your answer depends on your situation of requirements. Placing them in session takes up more memory, but if you don't place them in session you'll need to make more persistence and retrieval calls to the backend which takes up more processing power (and often network traffic).


A good workman is known by his tools.
Kinjal Sonpal
Ranch Hand

Joined: Jun 06, 2003
Posts: 96
Well, as far as this application is concerned, DB calls does not seem to be a big issue, as the DB is very well tuned and is handling really high amount of traffic. But, one of the reasons why I'm keeping data in session is because my DAO layer is comparatively much weak in design and we are using an inhouse persistance framework. The next section of the application may have hibernate or toplink, as I've been able to convince my boss for the need.

So, I think I'll go ahead with this strategy.

Thanks & regards,
Kinjal Sonpal
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
Handling the various aspects of wizards in a web application can get pretty hairy. I suggest you checkout Struts Workflow Extension, it sounds like it does everything that you would want for wizards (with the exception of the allowing the user to logoff and return to the same workflow). We are using it on a current project and it has actually worked out pretty well.
Kinjal Sonpal
Ranch Hand

Joined: Jun 06, 2003
Posts: 96
Hmmm.. Interesting link. I would like to integrate this into my application in the next phase. Since so much of work has already gone into the application, I think it'll be a little difficult to integrate this in current scenario. Requistion for the next phase already arrived from the client. So, it seems, I would continue the same strategy for the current module.

Thanks and regards,
Kinjal Sonpal
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Scoping of ActionForm