You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by tsuresh <su...@hotmail.com> on 2007/12/20 09:36:02 UTC

How to get session from panel ?

Hello,
I have Panel called MenuPanel and a page WelcomePage. When the user is
authenticated through Login page  the user is forwarded to WelcomePage. This
WelcomePage consists of MenuPanel. How do I get the user session from the
MenuPanel. I simply added the MenuPanel in WelcomePage as
........
 add(new MenuPanel("menuBar"));
........

and in MenuPanel I tried to get Session as
LoginSession sess = (LoginSession) getSession();

But this sess returned null;

I have made the LoginSession class. I have set user session in Login page as 
..
session.setUser(user);
....
Am i missing something?
thanks
-- 
View this message in context: http://www.nabble.com/How-to-get-session-from-panel---tp14432609p14432609.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: How to get session from panel ?

Posted by tsuresh <su...@hotmail.com>.

Done ,there was nothing wrong in the code that I did. The things got
complicated because of myself.
-- 
View this message in context: http://www.nabble.com/How-to-get-session-from-panel---tp14432609p14433513.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: How to get session from panel ?

Posted by Sebastiaan van Erk <se...@sebster.com>.
Actually, if you check out Component.getSession() you'll see it just 
does Session.get() as well, so the idiom below should have no 
implications for testing nor should there be other unexpected implications.

Regards,
Sebastiaan

Peter Ertl wrote:
> Looks interesting...
> 
>   MySession.get()
> 
> Will this reliably work in WicketTester or are there implication you 
> should be aware of?
> 
> Regards
> Peter
> 
> 
> Am 20.12.2007 um 10:27 schrieb Sebastiaan van Erk:
> 
>> Or Session.get(), or better yet use MySession.get() where in MySession 
>> you define the static method:
>>
>> public static MySession get() {
>>     return (MySession) Session.get();
>> }
>>
>> which avoids casts. (Use can use the same trick to get the application).
>>
>> Regards,
>> Sebastiaan
>>
>> Suad AlShamsi wrote:
>>> Did you try to get it from the application. 
>>> getApplicaion().getSession();
>>> tsuresh wrote:
>>>> Hello,
>>>> I have Panel called MenuPanel and a page WelcomePage. When the user is
>>>> authenticated through Login page  the user is forwarded to 
>>>> WelcomePage. This
>>>> WelcomePage consists of MenuPanel. How do I get the user session 
>>>> from the
>>>> MenuPanel. I simply added the MenuPanel in WelcomePage as
>>>> ........
>>>> add(new MenuPanel("menuBar"));
>>>> ........
>>>>
>>>> and in MenuPanel I tried to get Session as
>>>> LoginSession sess = (LoginSession) getSession();
>>>>
>>>> But this sess returned null;
>>>>
>>>> I have made the LoginSession class. I have set user session in Login 
>>>> page as ..
>>>> session.setUser(user);
>>>> ....
>>>> Am i missing something?
>>>> thanks
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 

Re: How to get session from panel ?

Posted by Peter Ertl <pe...@gmx.org>.
Looks interesting...

   MySession.get()

Will this reliably work in WicketTester or are there implication you  
should be aware of?

Regards
Peter


Am 20.12.2007 um 10:27 schrieb Sebastiaan van Erk:

> Or Session.get(), or better yet use MySession.get() where in  
> MySession you define the static method:
>
> public static MySession get() {
> 	return (MySession) Session.get();
> }
>
> which avoids casts. (Use can use the same trick to get the  
> application).
>
> Regards,
> Sebastiaan
>
> Suad AlShamsi wrote:
>> Did you try to get it from the application.  
>> getApplicaion().getSession();
>> tsuresh wrote:
>>> Hello,
>>> I have Panel called MenuPanel and a page WelcomePage. When the  
>>> user is
>>> authenticated through Login page  the user is forwarded to  
>>> WelcomePage. This
>>> WelcomePage consists of MenuPanel. How do I get the user session  
>>> from the
>>> MenuPanel. I simply added the MenuPanel in WelcomePage as
>>> ........
>>> add(new MenuPanel("menuBar"));
>>> ........
>>>
>>> and in MenuPanel I tried to get Session as
>>> LoginSession sess = (LoginSession) getSession();
>>>
>>> But this sess returned null;
>>>
>>> I have made the LoginSession class. I have set user session in  
>>> Login page as ..
>>> session.setUser(user);
>>> ....
>>> Am i missing something?
>>> thanks
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: How to get session from panel ?

Posted by Sebastiaan van Erk <se...@sebster.com>.
Or Session.get(), or better yet use MySession.get() where in MySession 
you define the static method:

public static MySession get() {
	return (MySession) Session.get();
}

which avoids casts. (Use can use the same trick to get the application).

Regards,
Sebastiaan

Suad AlShamsi wrote:
> Did you try to get it from the application. getApplicaion().getSession();
> 
> tsuresh wrote:
>> Hello,
>> I have Panel called MenuPanel and a page WelcomePage. When the user is
>> authenticated through Login page  the user is forwarded to 
>> WelcomePage. This
>> WelcomePage consists of MenuPanel. How do I get the user session from the
>> MenuPanel. I simply added the MenuPanel in WelcomePage as
>> ........
>>  add(new MenuPanel("menuBar"));
>> ........
>>
>> and in MenuPanel I tried to get Session as
>> LoginSession sess = (LoginSession) getSession();
>>
>> But this sess returned null;
>>
>> I have made the LoginSession class. I have set user session in Login 
>> page as ..
>> session.setUser(user);
>> ....
>> Am i missing something?
>> thanks
>>   
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 

Re: How to get session from panel ?

Posted by Suad AlShamsi <su...@gmail.com>.
Did you try to get it from the application. getApplicaion().getSession();

tsuresh wrote:
> Hello,
> I have Panel called MenuPanel and a page WelcomePage. When the user is
> authenticated through Login page  the user is forwarded to WelcomePage. This
> WelcomePage consists of MenuPanel. How do I get the user session from the
> MenuPanel. I simply added the MenuPanel in WelcomePage as
> ........
>  add(new MenuPanel("menuBar"));
> ........
>
> and in MenuPanel I tried to get Session as
> LoginSession sess = (LoginSession) getSession();
>
> But this sess returned null;
>
> I have made the LoginSession class. I have set user session in Login page as 
> ..
> session.setUser(user);
> ....
> Am i missing something?
> thanks
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org