File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Action for scope Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Action for scope" Watch "Action for scope" New topic

Action for scope

John Angel

Joined: May 16, 2001
Posts: 5
I read in an article for struts best practices that it is best to keep form in session scope. Personally I would want to keep the form in session scope only if it spans multiple jsp pages. Otherwise the default for me would be in request scope. I had noticed that if the form gets put in session scope, it befalls on the developer to take extra precuation in cleaning the form variables under various conditions. This leads to several bugs with previous data being present etc.
I would like to solicit other opinions regarding best practice for form scope
Marc Peabody
pie sneak

Joined: Feb 05, 2003
Posts: 4727

Would you mind posting a link to the article. I would rather read it before posting any... rebuttal.

A good workman is known by his tools.
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33102

Another reason for session scope is if you want the form to be populated when the user goes back to the query screen. This isn't a hard and fast rule, just something I've observed.

Other forms make perfect sense to keep in request scope.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
John Angel

Joined: May 16, 2001
Posts: 5
Here is the link to the article.

Look under form-bean scope.
I agree. Here's the link:
subject: Action for scope
jQuery in Action, 3rd edition