Details
Description
When there are multiple ICEfaces portlets on a portal page, it appears that the javax.faces.ViewState value is not always correctly applied to all the forms in the portlets.
For example, using the Chat portlet as an example, assume there are 2 instances on the portal page.
1) Interact with the first portlet by logging in.
2) Interact with the second portlet by logging in. At this point, the response contains an update to the first portlet at the <form> level (this should likely be more granular but that's a different issue). The updated form does NOT include the ViewState. There is another update for the ViewState in the response, but it is not correctly applied to the form.
3) Interact with the first portlet again by sending a message. Since this form does not contain the ViewState, the resulting request results in a new View and the UIViewRoot does not contain the old DOM as an attribute (which it would if the ViewState was provided). The resulting update comes back as a ViewRoot update, replacing the entire page.
So the issue seems to be center around why the ViewState is not properly restored to the form when it's updated.
For example, using the Chat portlet as an example, assume there are 2 instances on the portal page.
1) Interact with the first portlet by logging in.
2) Interact with the second portlet by logging in. At this point, the response contains an update to the first portlet at the <form> level (this should likely be more granular but that's a different issue). The updated form does NOT include the ViewState. There is another update for the ViewState in the response, but it is not correctly applied to the form.
3) Interact with the first portlet again by sending a message. Since this form does not contain the ViewState, the resulting request results in a new View and the UIViewRoot does not contain the old DOM as an attribute (which it would if the ViewState was provided). The resulting update comes back as a ViewRoot update, replacing the entire page.
So the issue seems to be center around why the ViewState is not properly restored to the form when it's updated.
Issue Links
- blocks
-
ICE-6018 Upgrade Chat portlet example
- Closed
It turns out that the check that jsf.js makes to prevent itself from being re-evaluated if there is more than one copy loaded is faulty. The current version of jsf.js does this:
if (!((jsf&& jsf.specversion&& jsf.specversion > 20000 ) && (jsf.implversion&& jsf.implversion > 2))){...
with the current specversion == 20000 and the current implversion being 3. The check should be changed to:
if (!((jsf&& jsf.specversion&& jsf.specversion >= 20000 ) && (jsf.implversion&& jsf.implversion >= 3))){...
so that it will only evaluate the file if jsf has not yet been defined by something equivalent or higher than the current values. The problem we have is that we are relying on registering callbacks to repair the ViewState in forms (a different bug that we are working around currently). We do this by checking every incoming update, retrieving the ViewState update if it's present, and applying it to any forms that don't have it applied. If a second jsf.js file gets re-evaluated, our callbacks are no longer registered and the ViewState fix doesn't get applied.