Hi,

On Wed, Apr 22, 2015 at 4:48 AM, Chris <chris...@gmx.at> wrote:

> Hi all,
>
> I need so share a list of strings between some objects during a session;
> Within the session, the list of strings will be deleted based on specific
> requests.
>
> Currently, I store them in the page but the disadvantage of this approach
> is that I have to delegate the list to each sub(sub)component.
>

You can create a helper class: PageHelper#getMyList(Page page) { return
((MyPage) page).getMyList();}
And use it in any component: MyList myList =
PageHelper.getMyList(getPage());


>
> Would it be good practice to store this directly in the wicket session?
> How to do this?
>

Yes. Just create a property/getter/setter in MySession and then use it:
((MySession) Session.get()).getMyList();
Make sure you synchronize the access to the list!


>
> A second approach would be to store it in the user object and inject this
> object in the individual components.
>

This is also an option. It could be a session scoped bean, or a provider...


>
> Could you give me a recommendation?
>
> Thanks, Chris
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

Reply via email to