You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by 彭光裕 <ro...@cht.com.tw> on 2009/04/07 10:52:02 UTC

setting TreeState in Wicket session?

I have a based web page which contains a wicket Tree, and need to keep the treestate for each extend webpages.
So I override the newTreeState( ) as below:
        Tree cMenuTree = new Tree("menuTree", createTreeModel()) {
            @Override
            protected ITreeState newTreeState() {
                ITreeState treeState = null;
                WicketSession session = (WicketSession) MenuPanel.this
                        .getSession();
                System.out.println("session.size:"
                        + session.getSizeInBytes());
                treeState = session.getTreeState();
                if (treeState == null) {
                    treeState = new DefaultTreeState();
                    session.setTreeState(treeState);
                }
                return treeState;
            }

But I find the size of WicketSession is increasing quickly while each webpage created.
I need to keep the treestate because of the template webpage.
Please teach me how to eliminate the session size to avoid StackOverflowError Exception.

Thanks.

Roland.