ICEfaces
  1. ICEfaces
  2. ICE-8419

Multiple duplicate javax.faces.ViewState ID's for one request

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.1
    • Fix Version/s: 3.2
    • Component/s: Framework
    • Labels:
      None
    • Environment:
      IE8/9 Compat Mode

      Description

      Multiple duplicate javax.faces.ViewState ID's are seen in the request information after an ajax request. The ID's seem to accumulate on each ajax request. This is only seen when using IE in the Compat Mode. If IE is in its regular mode then only one ID is shown and no duplicates.

      javax.faces.ViewState = -3966085397789727507:8247250183024548888
      -3966085397789727507:8247250183024548888
      -3966085397789727507:8247250183024548888

        Activity

        Hide
        Mircea Toma added a comment -

        Modified one remaining instance in our bridge were the javax.faces.ViewState input element was looked up by name instead of using the utility function lookupViewStateElement(). The function was introduced when we discovered that IE9 fails to look up the elements by complex names (such when the name contains dots).

        Show
        Mircea Toma added a comment - Modified one remaining instance in our bridge were the javax.faces.ViewState input element was looked up by name instead of using the utility function lookupViewStateElement(). The function was introduced when we discovered that IE9 fails to look up the elements by complex names (such when the name contains dots).
        Hide
        Mircea Toma added a comment - - edited

        Even if we fixed the source of the problem in our bridge the issue is not completely fixed. We need to prepare a patch for Mojarra, patch that will modify the lookup by name used in Mojarra's bridge with a function that will iterate over the form elements to find the input element that holds the view state key.

        We already provided a similar patch for Myfaces.

        Show
        Mircea Toma added a comment - - edited Even if we fixed the source of the problem in our bridge the issue is not completely fixed. We need to prepare a patch for Mojarra, patch that will modify the lookup by name used in Mojarra's bridge with a function that will iterate over the form elements to find the input element that holds the view state key. We already provided a similar patch for Myfaces.
        Hide
        Mircea Toma added a comment -

        Attached patch for Mojarra built off revision #10252 (trunk at 2012-07-09 20:39:26 +0300).

        Show
        Mircea Toma added a comment - Attached patch for Mojarra built off revision #10252 (trunk at 2012-07-09 20:39:26 +0300).
        Hide
        Ted Goddard added a comment -

        The full fix needs changes to both ICEfaces JavaScript in icefaces.jar and jsf.js in javax.faces.jar. Mircea can provide an ICEfaces patch (for support to apply to their branch) as well as a patched javax.faces.jar, but we need to know which version of mojarra to patch.

        Show
        Ted Goddard added a comment - The full fix needs changes to both ICEfaces JavaScript in icefaces.jar and jsf.js in javax.faces.jar. Mircea can provide an ICEfaces patch (for support to apply to their branch) as well as a patched javax.faces.jar, but we need to know which version of mojarra to patch.
        Hide
        Ted Goddard added a comment -

        Please provide information on which version of mojarra is required.

        Show
        Ted Goddard added a comment - Please provide information on which version of mojarra is required.
        Hide
        Mircea Toma added a comment -
        Show
        Mircea Toma added a comment - Created Mojarra bug: http://java.net/jira/browse/JAVASERVERFACES-2482 .
        Hide
        Deryk Sinotte added a comment -

        I tested this using IE 9 and using the Developer console to switch the browser modes (IE 9, 8, 7) as well as the the document modes (standards, quirks). I could only reproduce the problem in the test case when the document mode was set to "Quirks". Then I would see that additional ViewState parameters were being included in the form submission.

        To confirm, I used the debugger to show that the following line in jsf.js doUpdate():

        var field = stateForm.elements["javax.faces.ViewState"];

        is returning the field as "undefined" when running IE in Quirks mode. Not really sure why this is. Looking at the form, it appears the element array is there. And checking for the existence of other form elements using the exact same syntax works. For example:

        var buttonOne = stateForm.elements["button1"];

        returns the appropriate input element. So it must not like something about "javax.faces.ViewState". As Mircea noted, perhaps the dots where throwing it off but I tried a stand-alone script that simply iterated through a form and it was able to find the hidden input text name "javax.faces.ViewState" so there must be more variables involved.

        In any event, when it can't find a ViewState it goes ahead and appends a new one - which is why we see the multiple ViewStates being accumulating with each submission. The patch avoids this by checking to see if the ViewState is found and, if not, before adding a new one, tries an alternate approach of iterating through and comparing the each form.element.name with the incoming ViewState value.

        Show
        Deryk Sinotte added a comment - I tested this using IE 9 and using the Developer console to switch the browser modes (IE 9, 8, 7) as well as the the document modes (standards, quirks). I could only reproduce the problem in the test case when the document mode was set to "Quirks". Then I would see that additional ViewState parameters were being included in the form submission. To confirm, I used the debugger to show that the following line in jsf.js doUpdate(): var field = stateForm.elements ["javax.faces.ViewState"] ; is returning the field as "undefined" when running IE in Quirks mode. Not really sure why this is. Looking at the form, it appears the element array is there. And checking for the existence of other form elements using the exact same syntax works. For example: var buttonOne = stateForm.elements ["button1"] ; returns the appropriate input element. So it must not like something about "javax.faces.ViewState". As Mircea noted, perhaps the dots where throwing it off but I tried a stand-alone script that simply iterated through a form and it was able to find the hidden input text name "javax.faces.ViewState" so there must be more variables involved. In any event, when it can't find a ViewState it goes ahead and appends a new one - which is why we see the multiple ViewStates being accumulating with each submission. The patch avoids this by checking to see if the ViewState is found and, if not, before adding a new one, tries an alternate approach of iterating through and comparing the each form.element.name with the incoming ViewState value.
        Hide
        Mircea Toma added a comment -

        Created new issue http://java.net/jira/browse/JAVASERVERFACES-2500 that will hopefully be targeted to Mojarra 2.1.11.

        Show
        Mircea Toma added a comment - Created new issue http://java.net/jira/browse/JAVASERVERFACES-2500 that will hopefully be targeted to Mojarra 2.1.11.

          People

          • Assignee:
            Mircea Toma
            Reporter:
            Arran Mccullough
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: