[seam-issues] [JBoss JIRA] (JBSEAM-4898) JSF2 Page Scope components are not active on postback

John Gilbert (JIRA) jira-events at lists.jboss.org
Sat Feb 4 17:28:48 EST 2012


    [ https://issues.jboss.org/browse/JBSEAM-4898?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12664291#comment-12664291 ] 

John Gilbert commented on JBSEAM-4898:
--------------------------------------

What I have found so far is that with the old facelets jar installed the following method does not find a strategy and just restores the tree. Without the old facelets jar it finds a strategy which re-applies the facelet.

{code}
com.sun.faces.application.StateManagerImpl{ 

    public UIViewRoot restoreView(FacesContext context,
                                  String viewId,
                                  String renderKitId) {
        UIViewRoot result = null;
        StateManagementStrategy strategy = null;
        
        ViewDeclarationLanguage vdl =
              context.getApplication().getViewHandler().
                    getViewDeclarationLanguage(context, viewId);
        if (vdl != null) {
            strategy = vdl.getStateManagementStrategy(context, viewId);
        }

        if (null != strategy) {
            result = strategy.restoreView(context, viewId, renderKitId);
        } else {
            ResponseStateManager rsm =
                    RenderKitUtils.getResponseStateManager(context, renderKitId);
            Object[] state = (Object[]) rsm.getState(context, viewId);

            if (state != null && state.length >= 2) {
                // We need to clone the tree, otherwise we run the risk
                // of being left in a state where the restored
                // UIComponent instances are in the session instead
                // of the TreeNode instances.  This is a problem
                // for servers that persist session data since
                // UIComponent instances are not serializable.
                UIViewRoot viewRoot = null;
                if (state[0] != null) {
                    viewRoot = restoreTree(context,
                                           renderKitId,
                                           ((Object[]) state[0]).clone());
                }
                if (viewRoot != null && state[1] != null) {
                    viewRoot.processRestoreState(context, state[1]);
                }

                result = viewRoot;
            }
        }

        return result;

    }
{code}
                
> JSF2 Page Scope components are not active on postback
> -----------------------------------------------------
>
>                 Key: JBSEAM-4898
>                 URL: https://issues.jboss.org/browse/JBSEAM-4898
>             Project: Seam 2
>          Issue Type: Bug
>    Affects Versions: 2.3.0.ALPHA
>            Reporter: John Gilbert
>         Attachments: seam-scope-test-master.zip
>
>
> Page scoped components are not active on postback during the restore view phase. We have been doing things like this in JSF 1.2 for years with no trouble.
> {code}
> <ui:include src="#{pageScopedComponent.viewId}" />
> {code}
> In JSF 2 the page will render, because the facelet isn't actually complied until the render phase on a GET. Then on postback the component is not found in the stateful page scope and then isn't created because the page scope is not active yet.
> I have made many attempts to debug this but I have run out of ideas. I'm thinking this is a bug so I am posting it here. But if someone can give me some fresh ideas on where to look, I will keep digging.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the seam-issues mailing list