Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ActionForm

 
David Dhune
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In Struts, instantiation of an Action class happens only once and then other requests are threaded which uses the original object.

Is this true for ActionForm also (using its reset() method) for multiple requests (scope)?
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is definitely not true for ActionForms. In request scope, each request from each user has it's own instance of the ActionForm. This means there could be dozens or even hundreds of instances of this object in the JVM at any given time. Of course this also means the instance is eligible for garbage collection as soon as the request is complete.
 
David Dhune
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.

If the scope of the ActionForm is "session", then Is struts reuses the same original object if exists and call the reset method on it before using it between requests?
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, that's exactly right.
 
David Dhune
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Merrill.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic