• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Action for scope

 
John Angel
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Would you mind posting a link to the article. I would rather read it before posting any... rebuttal.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34074
337
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
John Angel
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic