[richfaces-issues] [JBoss JIRA] Updated: (RF-6746) a4j:include - FacesContext.getCurrentInstance().getViewRoot().getViewId() isn't always correct

Nick Belaevski (JIRA) jira-events at lists.jboss.org
Fri Apr 10 10:11:35 EDT 2009


     [ https://jira.jboss.org/jira/browse/RF-6746?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nick Belaevski updated RF-6746:
-------------------------------

    Fix Version/s: Future
         Assignee: Alexander Smirnov


> a4j:include - FacesContext.getCurrentInstance().getViewRoot().getViewId() isn't always correct
> ----------------------------------------------------------------------------------------------
>
>                 Key: RF-6746
>                 URL: https://jira.jboss.org/jira/browse/RF-6746
>             Project: RichFaces
>          Issue Type: Bug
>            Reporter: David Schlotfeldt
>            Assignee: Alexander Smirnov
>             Fix For: Future
>
>
> When a request is made by from inside a a4j:include component UIInclude will set the ViewIdHolder to it self. It does this to ensure FacesContext.getCurrentInstance().getViewRoot().getViewId() returns the viewId of the a4j:include.
> Everything works fine if you only need to access the viewId when its already rendered and its posting back.
> If you, as I am, change the viewId of the UIInclude (the UIInclude is bound to a property of a managed bean), when the page is rendered back it renders the new "view" assigned to the UIInclude. When its rendered any manage-bean used from inside the a4j:include will see the viewId as the "outter view" not the view assigned to the a4j:include.
> I believe the simplest and best solution easiest solution is when rendering the children of uiinclude to:
> ---
> AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
> ViewIdHolder viewIdHolder = ajaxContext.getViewIdHolder();   // Store reference to current
> ajaxContext.setViewIdHolder(this);  // This is UIInclude
> // render children here...
> ajaxContext.setViewIdHolder(viewIdHolder );  // Put previous back
> ---

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the richfaces-issues mailing list