At 6:48 AM -0400 4/18/05, Néstor Boscán wrote:
Hi

When I create a struts-config.xml that has many nodes that call the same
action class, is the action class instantietad once, or is instantiated for
every node?. What happens if I have a custom action mapping class, is
instantiated once or is instantiated for every node?.

Freddy pretty much answered you, but yes, by Struts original design, Action and ActionMapping classes are created once at Servlet initialization and are reused throughout.


Note that if you use the wildcard action-mapping functionality added in Struts 1.2, then necessarily a new ActionMapping is created for each request, because part of the functionality is to populate values of the mapping based on the details of the match. (see http://struts.apache.org/userGuide/building_controller.html#action_mapping_wildcards)


Several other MVC frameworks instantiate a controller (equivalent to a Struts Action) for each request, and in fact, the Spring Framework provides (among other ways) a way of integrating with Struts which results in a new Action class being created for each request (see http://www.springframework.org/docs/reference/webintegration.html#struts)


If you didn't want to use Spring, it would still be relatively easy to extend the Struts RequestProcessor (or in Struts 1.3, extend or replace the CreateAction command) so that an Action was created for each request.

Joe

--
Joe Germuska
[EMAIL PROTECTED]
http://blog.germuska.com
"Narrow minds are weapons made for mass destruction"  -The Ex

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to