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.