Yes, one of the ideas behind wicket is that you create your own custom
wicketsession to access your session objects in a typesafe way.

Using a propertymodel like Jeremy showed is a very elegant way of
getting back that information.

Maurice

On Mon, Jul 28, 2008 at 9:39 PM, Jeremy Thomerson
<[EMAIL PROTECTED]> wrote:
> I'm not sure what all you're trying to make easier, but as far as displaying
> the user - you could use this:
>
> new Label("username", new PropertyModel(this, "session.user.username"));
>
> --
> Jeremy Thomerson
> http://www.wickettraining.com
>
>
>
> On Mon, Jul 28, 2008 at 2:34 PM, insom <[EMAIL PROTECTED]> wrote:
>
>>
>> I'm trying to display a user's name in the browser. I'm using SWARM for
>> authentication. My general idea is that the user signs in with this
>> function:
>>
>> public boolean signIn(String username, String password) {
>>  LoginContext ctx = new FoodHandlerContext(username, password);
>>  MySession session = (MySession)getSession();
>>  session.login(ctx);
>>  session.setUser(session.getFoodHandlerDAO().getUserByUsername(username));
>> }
>>
>> Then, when I need any information about the user, I get it in the following
>> way:
>>
>> add(new Label(((MySession)getSession()).getUser().getUsername()));
>>
>> This works, but my sense of Wicket is that there's probably a better "best
>> practice" for maintaining session objects like the User. My question is,
>> can
>> I leverage Wicket's structure to make session object management easier than
>> I'm doing?
>> --
>> View this message in context:
>> http://www.nabble.com/Getting-User-from-Session-tp18697696p18697696.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to