]
Nick Belaevski updated RF-6746:
-------------------------------
Component/s: core
Fix Version/s: (was: 3.3.2.GA)
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
Components: core
Reporter: David Schlotfeldt
Assignee: Alexander Smirnov
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: