struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andreas Sachs" <andil...@gmx.de>
Subject Re: [S2] Session Created to late
Date Thu, 20 Nov 2008 07:26:23 GMT

Hello,
i want to put a object in every new session which provides basic sessionbased functionality.
E.g. 

isUserLoggedIn();
getUser();
getMenu(); (the menu depends on the user)

public ...sessionCreated() {
	MainManager mM = new mainManager()
	session.setattribut("mainManager",mM)
	}
	
Within the jsp i use:

#session.mM.user.name
or
#session.mM.menu....

I can initilize the session in the action, but i have some actions which are not sessionAware,
because they don't need that. E.g. the start-page. It simply returns the welcome-result. With
a new session #session.mM is not available in the jsp because the sessionCreated-Method is
called to late (At least it looks like that).

Maybe i should initialize the session with an interceptor.

Thanks
Andi



-------- Original-Nachricht --------
> Datum: Wed, 19 Nov 2008 19:25:54 +0100
> Von: "Nils-Helge Garli Hegvik" <nilsga@gmail.com>
> An: "Struts Users Mailing List" <user@struts.apache.org>
> Betreff: Re: [S2] Session Created to late

> What is it exactly that you want to achieve?
> 
> Nils-H
> 
> On Wed, Nov 19, 2008 at 6:51 PM, Andreas Sachs <andilist@gmx.de> wrote:
> > Hello,
> > i try to initialize a session with a HttpSessionListener class.
> >
> > The sessionCreated-Method is called AFTER setSession(Map map) of an
> Action-Class with SessionAware interface.
> >
> > Whats the right way to initilize a session when using struts2?
> >
> > Thanks
> > Andi
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org

-- 
Sensationsangebot nur bis 30.11: GMX FreeDSL - Telefonanschluss + DSL 
für nur 16,37 Euro/mtl.!* http://dsl.gmx.de/?ac=OM.AD.PD003K11308T4569a

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


Mime
View raw message