On 5/18/10 2:17 PM, Ken wrote:
Let me see if I understand this correctly.  Since the action object has
not been created yet, and this is in a different thread... I can not get
the correct context...  Although the session objects _is_ someplace...
It will also not work in the constructor even if the class is
SessionAware because the object must exist before setSession(Map m)
could be called...

You've not provided much context regarding the life cycle of the object you're trying to create, where it is created/used/stored, etc. So it's tough to answer specifically. There are numerous scopes in which objects of varying lifespans can be stored. It sounds like your object is a per-session object, even though you're going through a request to create it? Are there reasons it needs external resources (DB connection, etc.) that would mean it should be created and destroyed on a per-request basis (most reliable, don't have to worry about storage/serialization/clusters/etc.)? Are there reasons it needs to live longer than the request?

So...
I should really be treating execute() as my constructor for now... until
I better understand when the session variable becomes available.
Struts2 needs to see who I am before it knows my session right?  So it
isn't going to provide it to me until it has done a certain amount of
set up?

There are hooks for lots of different events, from application startup to session creation, to request processing, etc. The important part is to figure out your requirements, then we can suggest where to do the work/store the object.

-Dale

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to