aspose file tools*
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


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

Action for scope

John Angel
Greenhorn

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
Sheriff

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
Marshal

Joined: May 26, 2003
Posts: 30764
    
156

John,
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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
John Angel
Greenhorn

Joined: May 16, 2001
Posts: 5
Here is the link to the article.
http://www.javaworld.com/javaworld/jw-09-2004/jw-0913-struts-p3.html

Look under form-bean scope.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Action for scope