Your TreeModel is session scope right?

This works b/c the TreeState info is persisted with the component tree
which is lost when you use your redirects.  Like I said in the earlier
post, I'm pretty sure the redirects causes your component tree to be
dumped so that it cannot be restored.

When you only supply TreeNode (instead of TreeModel), an instance of
TreeModelBase is created which also creates an instance of
TreeStateBase.  Both of these instances die after the response is
rendered but the TreeStateBase info is stored in the JSF component
state so that it can be restored in the RestoreView phase of the next
request.

BTW, you never answered my question earlier about why you are using redirects.

sean


On 8/21/05, Enrique Medina <[EMAIL PROTECTED]> wrote:
> Hi Sean,
>  
>  Chaging the TreeNode to TreeModel has solved the problem.
>  
>  But could you please explain me why?
>  
>  Thanks in advance.
>  
>  
> 2005/8/21, Sean Schofield <[EMAIL PROTECTED]>:
> > I believe if you redirect to the same page you were on, you lose the
> > component tree.  I'm not sure about that though so maybe someone can
> > help clarify that point.  This would explain why your state stuff is
> > gone, b/c it is stored in the component by default. 
> > 
> > Take a look at the source for UITreeData.  In the new code you can now
> > provide your own TreeModel and TreeState class.  Instead of supplying
> > TreeNode like most of the simple examples, you can use TreeModel (like 
> > the expandAll example.)  Just make the bean that provides your
> > TreeModel have session scope.  Or you could continue to provide
> > everything in one TreeNode and make the bean that supplies that
> > information session scope.  I haven't tested this lately so let me 
> > know how it works out.
> > 
> > I'm not sure why you need to use redirects with a tree.  Is this so
> > the user can bookmark stuff?
> > 
> > sean
> > 
> > On 8/21/05, Enrique Medina < [EMAIL PROTECTED]> wrote:
> > > Hi,
> > >
> > >  Some weeks ago I started a discussion about redirecting instead of
> > > forwarding, and also provided with a simple listener to avoid the fact
> that
> > > the messages were lost in each redirection. 
> > >
> > >  Now I'm facing the same problem of loosing data in each redirection,
> but
> > > regarding the tree2 _restoredState property. Just for the sake of
> > > comprehension, this property is used to store the state of the tree 
> > > (expanded nodes for example), so when I do a redirect everything gets
> lost
> > > and the tree always shows completely collapsed, instead of expanded.
> > >
> > >  I was thinking that a workaround for this could be again to extend my 
> > > previous listener to also save the tree state in e.g. session, and then
> > > restore it before the render phase. Or maybe just switch to client state
> > > saving mode, but I don't know if there will appear collateral effects,
> as 
> > > I'm working with server state saving mode...
> > >
> > >  Any ideas?
> > >
> > 
> 
>

Reply via email to