You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Security Management <li...@secmgmt.com> on 2009/04/16 16:18:04 UTC
Storing interface instance in a user's session
I want to store a list of interface instances (i.e. UserImpl which
implements IUser), so I can have methods:
public void setUser(List<IUser> users)
{
This.getSession().put(SESSION_USER_LIST_KEY, users);
}
public List<IUser> getUsers()
{
return (List<IUser>) this.getSession().get(SESSION_USER_LIST_KEY);
}
I'm using Spring to manage struts objects. Can someone help, I'm having
trouble with finding out how in the documentation. Maybe my google keywords
are bad or something...
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Storing interface instance in a user's session
Posted by Lukasz Lenart <lu...@googlemail.com>.
2009/4/16 Security Management <li...@secmgmt.com>:
> I think I just was being dumb and did not make the IUser serializable, which
> should be all I need to do, yes?
Yes, you should get exception when session will be saved to disk.
Regards
--
Lukasz
http://www.lenart.org.pl/
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: Storing interface instance in a user's session
Posted by Security Management <li...@secmgmt.com>.
Thanks, I am doing that.
I think I just was being dumb and did not make the IUser serializable, which
should be all I need to do, yes?
-----Original Message-----
From: Jim Kiley [mailto:jhkiley@summa-tech.com]
Sent: Thursday, April 16, 2009 10:21 AM
To: Struts Users Mailing List
Subject: Re: Storing interface instance in a user's session
If you use SessionAware in your actions, you can receive a Map that
represents the session. You could pass that Map into your user manager
class, and do the storage that way.
On Thu, Apr 16, 2009 at 10:18 AM, Security Management <
list-subscriptions@secmgmt.com> wrote:
> I want to store a list of interface instances (i.e. UserImpl which
> implements IUser), so I can have methods:
>
> public void setUser(List<IUser> users)
> {
> This.getSession().put(SESSION_USER_LIST_KEY, users);
> }
>
> public List<IUser> getUsers()
> {
> return (List<IUser>) this.getSession().get(SESSION_USER_LIST_KEY);
> }
>
> I'm using Spring to manage struts objects. Can someone help, I'm having
> trouble with finding out how in the documentation. Maybe my google
> keywords
> are bad or something...
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
--
Jim Kiley
Senior Technical Consultant | Summa
[p] 412.258.3346
http://www.summa-tech.com
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Storing interface instance in a user's session
Posted by Jim Kiley <jh...@summa-tech.com>.
If you use SessionAware in your actions, you can receive a Map that
represents the session. You could pass that Map into your user manager
class, and do the storage that way.
On Thu, Apr 16, 2009 at 10:18 AM, Security Management <
list-subscriptions@secmgmt.com> wrote:
> I want to store a list of interface instances (i.e. UserImpl which
> implements IUser), so I can have methods:
>
> public void setUser(List<IUser> users)
> {
> This.getSession().put(SESSION_USER_LIST_KEY, users);
> }
>
> public List<IUser> getUsers()
> {
> return (List<IUser>) this.getSession().get(SESSION_USER_LIST_KEY);
> }
>
> I'm using Spring to manage struts objects. Can someone help, I'm having
> trouble with finding out how in the documentation. Maybe my google
> keywords
> are bad or something...
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
--
Jim Kiley
Senior Technical Consultant | Summa
[p] 412.258.3346
http://www.summa-tech.com