ICEfaces
  1. ICEfaces
  2. ICE-6022

ViewState is not correctly applied to all portlets on a page

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0-Beta1
    • Fix Version/s: 2.0.0
    • Component/s: Bridge, Framework
    • Labels:
      None
    • Environment:
      ICEfaces 2 Portlets

      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.

        Issue Links

          Activity

          Hide
          Deryk Sinotte added a comment -

          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.

          Show
          Deryk Sinotte added a comment - 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.
          Hide
          Deryk Sinotte added a comment -

          Attaching a patch to jsf.js that corrects the issue.

          Show
          Deryk Sinotte added a comment - Attaching a patch to jsf.js that corrects the issue.
          Hide
          Mircea Toma added a comment -

          Recorded issue in Mojarra's bug tracking system: https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=1814

          Show
          Mircea Toma added a comment - Recorded issue in Mojarra's bug tracking system: https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=1814
          Hide
          Deryk Sinotte added a comment -

          After wading through the repositories that are in a bit of flux, the change has been applied as of Nov 19 and is available as part of the JSF 2.1.0_b08 release:

          ------------------------------------------------------------------------
          r8730 | sheetalv | 2010-11-23 18:00:08 -0800 (Tue, 23 Nov 2010) | 1 line

          Tag 2.1.0 Build 08
          ------------------------------------------------------------------------
          r8727 | rogerk | 2010-11-19 13:51:47 -0800 (Fri, 19 Nov 2010) | 1 line

          Mojarra Issue: 1814: Ensure jsf.js is loaded once if referenced more than once.

          The latest Glassfish that I could download as of today only seemed to included 2.1.0_b07.

          Show
          Deryk Sinotte added a comment - After wading through the repositories that are in a bit of flux, the change has been applied as of Nov 19 and is available as part of the JSF 2.1.0_b08 release: ------------------------------------------------------------------------ r8730 | sheetalv | 2010-11-23 18:00:08 -0800 (Tue, 23 Nov 2010) | 1 line Tag 2.1.0 Build 08 ------------------------------------------------------------------------ r8727 | rogerk | 2010-11-19 13:51:47 -0800 (Fri, 19 Nov 2010) | 1 line Mojarra Issue: 1814: Ensure jsf.js is loaded once if referenced more than once. The latest Glassfish that I could download as of today only seemed to included 2.1.0_b07.
          Hide
          Deryk Sinotte added a comment -

          Re-opening the case.

          Due to a bug in their version checking, the Mojarra jsf.js script gets evaluated multiple times - once for each portlet. This causes the some of our handlers to be unregistered which, in turn, prevents our ViewState fix for forms from being applied.

          The bug that was submitted to Mojarra (https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=1814) has been fixed and is available in a 2.1 tag (http://java.net/projects/mojarra/sources/svn/show/tags/2.1.0-b08) but is not available in the latest 2.0 tag (http://java.net/projects/mojarra/sources/svn/show/tags/2.0.4-b06). I tried the 2.1 release but there are a number of issues with the the PortletFaces Brdige that currently prevent it from working reliably. We've been using a 2.0.4-b05 release for portlets up to this point so it's been relatively well tested. I've checked out the 2.0.4-b06 version myself from their repository, applied the very simple patch that we originally supplied to them, and rebuilt our own custom version of 2.0.4_b06 that includes this change. The slightly modifed versions of the libraries are now checked in under icefaces/lib/portlets/jsf-*.jar.

          Show
          Deryk Sinotte added a comment - Re-opening the case. Due to a bug in their version checking, the Mojarra jsf.js script gets evaluated multiple times - once for each portlet. This causes the some of our handlers to be unregistered which, in turn, prevents our ViewState fix for forms from being applied. The bug that was submitted to Mojarra ( https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=1814 ) has been fixed and is available in a 2.1 tag ( http://java.net/projects/mojarra/sources/svn/show/tags/2.1.0-b08 ) but is not available in the latest 2.0 tag ( http://java.net/projects/mojarra/sources/svn/show/tags/2.0.4-b06 ). I tried the 2.1 release but there are a number of issues with the the PortletFaces Brdige that currently prevent it from working reliably. We've been using a 2.0.4-b05 release for portlets up to this point so it's been relatively well tested. I've checked out the 2.0.4-b06 version myself from their repository, applied the very simple patch that we originally supplied to them, and rebuilt our own custom version of 2.0.4_b06 that includes this change. The slightly modifed versions of the libraries are now checked in under icefaces/lib/portlets/jsf-*.jar.
          Hide
          Deryk Sinotte added a comment -

          Modified versions of 2.0.4-b06 libs are checked in with the patch applied. Resolving as fixed until such time as an official release which includes the patch can be used. Testing the the chat portlet shows that the problem of the missing ViewState is gone and the portlets no longer do a full ViewRoot update because of this.

          Show
          Deryk Sinotte added a comment - Modified versions of 2.0.4-b06 libs are checked in with the patch applied. Resolving as fixed until such time as an official release which includes the patch can be used. Testing the the chat portlet shows that the problem of the missing ViewState is gone and the portlets no longer do a full ViewRoot update because of this.

            People

            • Assignee:
              Deryk Sinotte
              Reporter:
              Deryk Sinotte
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: