As far as instances go, you should treat an Action the way you would a
servlet.  The same instance is reused by Struts in responding to
multiple requests.  Because of this, you can easily get conflicting
data when you use an Action instance variable for purposes specific to
a certain request.
For example, let's say you use an instance variable to say who the
current user is. You set the value at the start of the request, then
use the value before you're done processing.  If two or more requests
come in at around the same time, this value stored by the first
request being processed would no longer be there by the time it
finishes processing, since other requests in other threads have
already started executing and had overwritten that value.
Geez, I hope my explanation didn't make it even more confusing.
Bottom line: an Action instance should be treated as a multi-request,
multi-threaded object.  Avoid Action instance variables for
request-specific purposes.

On Thu, 26 Aug 2004 11:09:24 -0400, Zhang, Larry (L.) <[EMAIL PROTECTED]> wrote:
> Can some one tell me why the above is correct? Thanks.
> 
> ---------------------------------------------------------------------
> 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]

Reply via email to