a4j:include - FacesContext.getCurrentInstance().getViewRoot().getViewId() isn't always
correct
----------------------------------------------------------------------------------------------
Key: JBSEAM-4100
URL:
https://jira.jboss.org/jira/browse/JBSEAM-4100
Project: Seam
Issue Type: Bug
Affects Versions: 2.1.1.GA
Reporter: David Schlotfeldt
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