ICEfaces
  1. ICEfaces
  2. ICE-5728

ViewState is not applied to all forms

    Details

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

      Description

      Based on the navigation test (samples/test/nav) It looks like there may be a problem during certain navigation scenarios.

      If you click on a button that causes a full page replacement (ie a ViewRoot update), then the ViewState does not appear to be re-applied to all the forms in the page. This leads to the next submission likely not working properly.

      In the navigation test identified above, if you click a button that posts back to the same page and:

      - with stock JSF 2, has f:ajax render='all' or
      - is enabled with ICEfaces

      the resulting full page update is applied but the ViewState update is not applied to all the forms.

      If you then click a button that attempts to navigate to page 2, it will not work because the ViewState is not included. Instead, you'll get another ViewRoot update of the full page, which will then properly apply the ViewState to all the forms and the next click will work as designed and navigate you to page 2.

        Issue Links

          Activity

          Deryk Sinotte created issue -
          Hide
          Deryk Sinotte added a comment -

          This issue doesn't appear to be fixed in Mojarra as of a snapshot build on 2010-05-17. Our current thinking is that our best strategy to work around this in the short-term is to query any requests and check to see if the javax.faces.ViewState parameter is being included. If it isn't, add it in ourselves.

          Show
          Deryk Sinotte added a comment - This issue doesn't appear to be fixed in Mojarra as of a snapshot build on 2010-05-17. Our current thinking is that our best strategy to work around this in the short-term is to query any requests and check to see if the javax.faces.ViewState parameter is being included. If it isn't, add it in ourselves.
          Deryk Sinotte made changes -
          Field Original Value New Value
          Salesforce Case []
          Assignee Mircea Toma [ mircea.toma ]
          Hide
          Deryk Sinotte added a comment -

          Just to clarify this a bit further, using the samples/test/nav case with stock JSF (ie no ICEfaces):

          1) Load the page (h

          2) In a JavaScript console, you can check that the number of ViewState nodes in the document matches the number of forms in the page:

          document.getElementsByName('javax.faces.ViewState').length;
          13

          3) Click either of the buttons in the top table (this is a postback to the same page) that have f:ajax render='all'. Either button A2 or A5 will do.

          4) In a JavaScript console, you can check that the number of ViewState nodes in the document is no longer correct:

          document.getElementsByName('javax.faces.ViewState').length;
          1

          Show
          Deryk Sinotte added a comment - Just to clarify this a bit further, using the samples/test/nav case with stock JSF (ie no ICEfaces): 1) Load the page (h 2) In a JavaScript console, you can check that the number of ViewState nodes in the document matches the number of forms in the page: document.getElementsByName('javax.faces.ViewState').length; 13 3) Click either of the buttons in the top table (this is a postback to the same page) that have f:ajax render='all'. Either button A2 or A5 will do. 4) In a JavaScript console, you can check that the number of ViewState nodes in the document is no longer correct: document.getElementsByName('javax.faces.ViewState').length; 1
          Mircea Toma made changes -
          Salesforce Case []
          Fix Version/s 2.0-Alpha3 [ 10032 ]
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #21437 Tue May 18 08:03:31 MDT 2010 mircea.toma ICE-5728 Introduce system event listener that renders javax.faces.ViewState field into the forms when old DOM is missing due to navigation.
          Files Changed
          Commit graph MODIFY /icefaces/scratchpads/glimmer/core/src/main/resources/META-INF/faces-config.xml
          Commit graph MODIFY /icefaces/scratchpads/glimmer/core/src/main/java/org/icefaces/context/DOMResponseWriter.java
          Commit graph ADD /icefaces/scratchpads/glimmer/core/src/main/java/org/icefaces/event/JSFViewStateNavigationFix.java
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #21438 Tue May 18 10:03:50 MDT 2010 deryk.sinotte ICE-5728: disable listening for now
          Files Changed
          Commit graph MODIFY /icefaces/scratchpads/glimmer/core/src/main/java/org/icefaces/event/JSFViewStateNavigationFix.java
          Hide
          Mircea Toma added a comment -

          Introduce system event listener that inserts a component responsible to render javax.faces.ViewState field into the forms when old DOM is missing due to navigation.

          Show
          Mircea Toma added a comment - Introduce system event listener that inserts a component responsible to render javax.faces.ViewState field into the forms when old DOM is missing due to navigation.
          Mircea Toma made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #21440 Tue May 18 10:43:46 MDT 2010 deryk.sinotte ICE-5728: setting explicit id to prevent duplicate id problems
          Files Changed
          Commit graph MODIFY /icefaces/scratchpads/glimmer/core/src/main/java/org/icefaces/event/JSFViewStateNavigationFix.java
          Hide
          Deryk Sinotte added a comment -

          This appears to fix the problem with both the nav test case and the Mojarra unit test that was failing. However, I am seeing some JavaScript errors in the WebKit browsers:

          Safari: TypeError: Result of expression 'document.getElementById('vuoah0w5_icefaces_config')' [null] is not an object.

          Chrome: Uncaught TypeError: Cannot read property 'parentNode' of null

          Firefox: No error

          Show
          Deryk Sinotte added a comment - This appears to fix the problem with both the nav test case and the Mojarra unit test that was failing. However, I am seeing some JavaScript errors in the WebKit browsers: Safari: TypeError: Result of expression 'document.getElementById('vuoah0w5_icefaces_config')' [null] is not an object. Chrome: Uncaught TypeError: Cannot read property 'parentNode' of null Firefox: No error
          Hide
          Deryk Sinotte added a comment -

          I added a line of code as suggested by Ted that adds an id to the UIOutput to prevent the duplicate id problem when we were running the Mojarra unit tests. The JavaScript errors noted above are still there so re-opening for further investigation.

          Show
          Deryk Sinotte added a comment - I added a line of code as suggested by Ted that adds an id to the UIOutput to prevent the duplicate id problem when we were running the Mojarra unit tests. The JavaScript errors noted above are still there so re-opening for further investigation.
          Deryk Sinotte made changes -
          Resolution Fixed [ 1 ]
          Status Resolved [ 5 ] Reopened [ 4 ]
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #21443 Tue May 18 13:47:25 MDT 2010 mircea.toma ICE-5728 Enclose script element with 'span' so that when DOM update needs to re-evaluate the script can lookup the enclosing element.
          Files Changed
          Commit graph MODIFY /icefaces/scratchpads/glimmer/core/src/main/java/org/icefaces/event/BridgeSetup.java
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #21444 Tue May 18 14:01:00 MDT 2010 mircea.toma ICE-5728 Simplify code by using UIOutputWriter component.
          Files Changed
          Commit graph MODIFY /icefaces/scratchpads/glimmer/core/src/main/java/org/icefaces/event/WindowAndViewIDSetup.java
          Commit graph MODIFY /icefaces/scratchpads/glimmer/core/src/main/java/org/icefaces/event/JSFViewStateNavigationFix.java
          Commit graph MODIFY /icefaces/scratchpads/glimmer/core/src/main/java/org/icefaces/event/BridgeSetup.java
          Commit graph MODIFY /icefaces/scratchpads/glimmer/core/src/main/java/org/icefaces/event/UIOutputWriter.java
          Hide
          Mircea Toma added a comment -

          Enclosed script element with 'span' so that during a DOM update the script can lookup the enclosing element. The script elements are evaluated (not inserted in the document) by the JSF bridge.

          Show
          Mircea Toma added a comment - Enclosed script element with 'span' so that during a DOM update the script can lookup the enclosing element. The script elements are evaluated (not inserted in the document) by the JSF bridge.
          Mircea Toma made changes -
          Status Reopened [ 4 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Mircea Toma made changes -
          Link This issue blocks ICE-5675 [ ICE-5675 ]
          Mircea Toma made changes -
          Link This issue blocks ICE-5675 [ ICE-5675 ]
          Mircea Toma made changes -
          Link This issue depends on ICE-5675 [ ICE-5675 ]
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #21461 Sun May 23 03:22:29 MDT 2010 mircea.toma ICE-5728 Apply fix only for ICEfaces enabled views.
          Files Changed
          Commit graph MODIFY /icefaces/scratchpads/glimmer/core/src/main/java/org/icefaces/event/JSFViewStateNavigationFix.java
          Ken Fyten made changes -
          Fix Version/s 2.0.0 [ 10230 ]
          Ken Fyten made changes -
          Status Resolved [ 5 ] Closed [ 6 ]

            People

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

              Dates

              • Created:
                Updated:
                Resolved: