You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Brandon Goodin <ma...@phase.ws> on 2003/01/25 10:26:01 UTC

Action Instantiation

This may be a Struts 101 question. But, when a request comes through the
ActionServlet and is forwarded to an Action class.... how are the Action
classes instantiated. Is a new Action class instantiated for each request or
is an Action class instantiated once and reused for all requests?

Brandon Goodin
Phase Web and Multimedia
P (406) 862-2245
F (406) 862-0354
mail@phase.ws
http://www.phase.ws



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Action Instantiation

Posted by Brandon Goodin <ma...@phase.ws>.
Ya, sometimes I just can't decide which board to post to. But, thanks I
appreciate the info and the link. I just wanted to make sure that the
ValidatorLookupDispatchAction I submitted as an enhancement was properly
coded and thread safe. And.... it is. Thanks Ted.. "YOU DA MAN!" ;-)

Brandon Goodin
Phase Web and Multimedia
P (406) 862-2245
F (406) 862-0354
mail@phase.ws
http://www.phase.ws


-----Original Message-----
From: Ted Husted [mailto:husted@apache.org]
Sent: Saturday, January 25, 2003 3:03 AM
To: Struts Developers List
Subject: Re: Action Instantiation


The best place to ask anything that might be a Struts 101 question is
the Struts USER list.

http://jakarta.apache.org/struts/doc-1.0.2/userGuide/building_controller.htm
l#action_classes

"* The controller servlet creates only one instance of your Action
class, and uses it for all requests. Thus, you need to code your Action
class so that it operates correctly in a multi-threaded environment,
just as you must code a servlet's service() method safely."

In Struts 1.0, all Actions are instantiated lazily. In Struts 1.1,
Actions with a PlugIn interfaces are instantiated at startup.

Brandon Goodin wrote:
> This may be a Struts 101 question. But, when a request comes through the
> ActionServlet and is forwarded to an Action class.... how are the Action
> classes instantiated. Is a new Action class instantiated for each request
or
> is an Action class instantiated once and reused for all requests?
>
> Brandon Goodin
> Phase Web and Multimedia
> P (406) 862-2245
> F (406) 862-0354
> mail@phase.ws
> http://www.phase.ws
>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>


--
Ted Husted,
Struts in Action <http://husted.com/struts/book.html>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Action Instantiation

Posted by Ted Husted <hu...@apache.org>.
The best place to ask anything that might be a Struts 101 question is 
the Struts USER list.

http://jakarta.apache.org/struts/doc-1.0.2/userGuide/building_controller.html#action_classes

"* The controller servlet creates only one instance of your Action 
class, and uses it for all requests. Thus, you need to code your Action 
class so that it operates correctly in a multi-threaded environment, 
just as you must code a servlet's service() method safely."

In Struts 1.0, all Actions are instantiated lazily. In Struts 1.1, 
Actions with a PlugIn interfaces are instantiated at startup.

Brandon Goodin wrote:
> This may be a Struts 101 question. But, when a request comes through the
> ActionServlet and is forwarded to an Action class.... how are the Action
> classes instantiated. Is a new Action class instantiated for each request or
> is an Action class instantiated once and reused for all requests?
> 
> Brandon Goodin
> Phase Web and Multimedia
> P (406) 862-2245
> F (406) 862-0354
> mail@phase.ws
> http://www.phase.ws
> 
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 
> 


-- 
Ted Husted,
Struts in Action <http://husted.com/struts/book.html>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>