Changing context(tool.session) object

View: New views
3 Messages — Rating Filter:   Alert me  

Changing context(tool.session) object

by Sheldon Ross :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I have used session tools before, but normally I can use the tool I put in session.
In this case, I want to overwrite the tool, and keep it across the session, is there a way to do this?

ex: TurbineResources prop

tool.session.myObj = org.myapp.taglibs.Obj


Code:

Obj obj = (Obj)context.get("myObj");
obj = new Obj();

This doesn't seem to work because it doesn't actually change the session's reference?
Or am I doing something wrong. Is there a better way to keep an object persistent in a session?

Thanks alot,

Sheldon Ross

_________________________________________________________________
Windows Live™ Hotmail®:…more than just e-mail.
http://windowslive.com/explore?ocid=TXT_TAGLM_WL_t2_hm_justgotbetter_explore_012009

RE: Changing context(tool.session) object

by Tony Oslund-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

data.getSession().setAttribute("MYTAG", myObj);
data.getSession().getAttribute("MYTAG");


Tony

-----Original Message-----
From: Sheldon Ross [mailto:ross_sheldon@...]
Sent: Tuesday, February 03, 2009 4:58 PM
To: turbine-user@...
Subject: Changing context(tool.session) object


I have used session tools before, but normally I can use the tool I put
in session.
In this case, I want to overwrite the tool, and keep it across the
session, is there a way to do this?

ex: TurbineResources prop

tool.session.myObj = org.myapp.taglibs.Obj


Code:

Obj obj = (Obj)context.get("myObj");
obj = new Obj();

This doesn't seem to work because it doesn't actually change the
session's reference?
Or am I doing something wrong. Is there a better way to keep an object
persistent in a session?

Thanks alot,

Sheldon Ross

_________________________________________________________________
Windows Live(tm) Hotmail(r):...more than just e-mail.
http://windowslive.com/explore?ocid=TXT_TAGLM_WL_t2_hm_justgotbetter_exp
lore_012009

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@...
For additional commands, e-mail: user-help@...


RE: Changing context(tool.session) object

by Sheldon Ross :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I tried that and it didn't seem to work. I ended up just putting the object in SessionData when the user logs in.

ie:
tool.session.sessionData=org.apache.turbine.services.pull.util.SessionData

It seems to work well and seems to just be an implementation of HashMap.

Thanks!

> Subject: RE: Changing context(tool.session) object
> Date: Wed, 4 Feb 2009 09:05:47 -0600
> From: TonyO@...
> To: user@...
>
> data.getSession().setAttribute("MYTAG", myObj);
> data.getSession().getAttribute("MYTAG");
>
>
> Tony
>
> -----Original Message-----
> From: Sheldon Ross [mailto:ross_sheldon@...]
> Sent: Tuesday, February 03, 2009 4:58 PM
> To: turbine-user@...
> Subject: Changing context(tool.session) object
>
>
> I have used session tools before, but normally I can use the tool I put
> in session.
> In this case, I want to overwrite the tool, and keep it across the
> session, is there a way to do this?
>
> ex: TurbineResources prop
>
> tool.session.myObj = org.myapp.taglibs.Obj
>
>
> Code:
>
> Obj obj = (Obj)context.get("myObj");
> obj = new Obj();
>
> This doesn't seem to work because it doesn't actually change the
> session's reference?
> Or am I doing something wrong. Is there a better way to keep an object
> persistent in a session?
>
> Thanks alot,
>
> Sheldon Ross
>
> _________________________________________________________________
> Windows Live(tm) Hotmail(r):...more than just e-mail.
> http://windowslive.com/explore?ocid=TXT_TAGLM_WL_t2_hm_justgotbetter_exp
> lore_012009
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@...
> For additional commands, e-mail: user-help@...
>

_________________________________________________________________
Windows Live™: Keep your life in sync.
http://windowslive.com/explore?ocid=TXT_TAGLM_WL_t1_allup_explore_022009