RE: Actions and Action Mappings instantiated once?

2005-04-18 Thread Freddy Villalba A.
Hello, Nestor.

I'm not sure what you mean exactly by node. Anyway, according to Struts'
online doc:

Write code for a multi-threaded environment - The controller servlet
creates only one instance of your Action class, and uses this one instance
to service all requests...

Not sure if this is what you mean, though.

Cheers,
Freddy.

-Mensaje original-
De: Néstor Boscán [mailto:[EMAIL PROTECTED]
Enviado el: lunes, 18 de abril de 2005 12:49
Para: 'Struts Users Mailing List'
Asunto: Actions and Action Mappings instantiated once?


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?.

Regards,

Néstor Boscán


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


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



Re: Actions and Action Mappings instantiated once?

2005-04-18 Thread Joe Germuska
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]