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

ActionForm

David Dhune
Greenhorn

Joined: Sep 28, 2006
Posts: 14
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

Joined: Feb 15, 2005
Posts: 4864
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.


Merrill
Consultant, Sima Solutions
David Dhune
Greenhorn

Joined: Sep 28, 2006
Posts: 14
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

Joined: Feb 15, 2005
Posts: 4864
Yes, that's exactly right.
David Dhune
Greenhorn

Joined: Sep 28, 2006
Posts: 14
Thanks Merrill.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ActionForm
 
Similar Threads
Struts: request parameters and ActionForms
struts 2 forms
Database validation in Action or Bean?
When is form Bean created ?
Passing values to jsp