Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Scoping of ActionForm

 
Kinjal Sonpal
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
Kinjal Sonpal
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2712
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic