myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Xavier Cho (JIRA)" <...@myfaces.apache.org>
Subject [jira] [Comment Edited] (MYFACES-3840) UIViewRoot uses different id while saving and restoring states.
Date Fri, 14 Feb 2014 13:08:19 GMT

    [ https://issues.apache.org/jira/browse/MYFACES-3840?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13901401#comment-13901401
] 

Xavier Cho edited comment on MYFACES-3840 at 2/14/14 1:07 PM:
--------------------------------------------------------------

Sorry for the late response. It seems that it's the famous 'chicken-egg' problem with using
view scope with component binding, as described (and fixed) by this Mojarra issue :

-  https://java.net/jira/browse/JAVASERVERFACES-1492

When PSS is enabled and a managed bean with a component binding is itself view scoped or depends
on one, new instance of the view scoped bean is created as existing instance cannot be referenced,
because the view attributes is not yet restored when _vdl.buildView (context, view);_ is invoked
in _DefaultFaceletsStateManagementStrategy:222_ (line numbers are from 2.2.0).

However, I wonder exactly when _view.restoreViewScopeState(context, viewRootState);_ (325
line) is triggered, as if this line is executed, the above problem can be solved as well.

I verified this behavior, by temporarily override UIViewRoot, so that it's clientId to be
the same with its view ID, which would make the said line to be executed.

I'm wondering if it could really be the solution to the problem, or for now, it's just impossible
to use component binding with PSS enabled for MyFaces.


was (Author: mysticfall):
Sorry for the late response. It seems that it's the famous 'chicken-egg' problem with using
view scope with component binding, as described (and fixed) by this Mojarra issue :

-  https://java.net/jira/browse/JAVASERVERFACES-1492

When PSS is enabled and a managed bean with a component binding is itself view scoped or depends
on one, new instance of the view scoped bean is created as existing instance cannot be referenced,
as the view attributes is not yet restored when _vdl.buildView (context, view);_ is invoked
in _DefaultFaceletsStateManagementStrategy:222_ (line numbers are from 2.2.0).

However, I wonder exactly when _view.restoreViewScopeState(context, viewRootState);_ (325
line) is triggered, as if this line is executed, the above problem can be solved as well.

I verified this behavior, by temporarily override UIViewRoot, so that it's clientId to be
the same with its view ID, which would make the said line to be executed.

I'm wondering if it could really be the solution to the problem, or for now, it's just impossible
to use component binding with PSS enabled for MyFaces.

> UIViewRoot uses different id while saving and restoring states.
> ---------------------------------------------------------------
>
>                 Key: MYFACES-3840
>                 URL: https://issues.apache.org/jira/browse/MYFACES-3840
>             Project: MyFaces Core
>          Issue Type: Bug
>    Affects Versions: 2.2.0-beta
>            Reporter: Xavier Cho
>            Assignee: Leonardo Uribe
>
> After I upgraded to 2.2.0-beta, every postback requests which requires @ViewScoped managed
beans fails as they lose states after the initial request.
> I couldn't spend sufficient time to investigate so not perfectly sure if it's not caused
by some misconfiguration on my end.
> Though, after a quick debugging, I found that in the DefaultFaceletsStateManagementStrategy
class, state of an UIViewRoot instance is saved using its client ID in saveStateOnMapVisitTree:976,
but it tries to restore it using its view ID in restoreView:301, thus failing to restore the
state.
> Is this behavior normal? If so, what possible configuration could cause it to use different
IDs between saving and restoring state?



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Mime
View raw message