javaserverfaces-spec-public
  1. javaserverfaces-spec-public
  2. JAVASERVERFACES_SPEC_PUBLIC-790

javax.faces.ViewState + PPR does not work out for cross form ppr cases

    Details

    • Type: Bug Bug
    • Status: In Progress
    • Priority: Critical Critical
    • Resolution: Unresolved
    • Affects Version/s: 2.0
    • Fix Version/s: 2.3
    • Component/s: Ajax/JavaScript
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: Macintosh

    • Issuezilla Id:
      790
    • Status Whiteboard:
      Hide

      size_small importance_small

      Show
      size_small importance_small

      Description

      Following problem

      <h:form id="a">
          <h:commandButton action="#{TestBean.action}" value="submit"/>
      </h:form>
      
      <h:form id="b">
          <h:commandLink value="ajax ReRender" 
              onclick="jsf.ajax.request(this,event,{execute:'b a',render:'a'}); return false;"/>
      </h:form> 
      

      Cannot work out because, the viewstate is returned as separate viewstate block
      (in both implementations the <update id="a"> does not pass the viewState in the
      update block).

      Now the specification says:

      If an update element is found in the response with the identifier
      javax.faces.ViewState:

      <update id="javax.faces.ViewState">
         <![CDATA[...]]>
      </update>
      

      locate and update the submitting form's javax.faces.ViewState value with the
      CDATA contents from the response.

      Which means in this special case that the viewState for form a is lost.
      Mojarra has fixed this to some degree by setting the viewstate if a direct form
      render on a happens.

      However if you do following:

      <h:panelGroup id="myGroup">
          <h:form id="a">
              <h:commandButton action="#{TestBean.action}" value="submit"/>
          </h:form>
      </h:panelGroup>
      
      <h:form id="b">
          <h:commandLink value="ajax ReRender" 
              onclick="jsf.ajax.request(this,event,{execute:'b a',render:'myGroup'}); return false;"/>
      </h:form> 
      

      Mojarra also fails.

      The problem here lies clearly with the spec, I am not sure why the viewstate is
      only updated to the issuing form.

      Either all forms must be updated or at least the forms which are processed both
      within the execute and render parts.

      I also opened a discussion on the open mailing list regarding this, since this is
      a usecase which can happen quite often in a typical rich client scenario where a
      lot of detachments can happen to satisfy ie6 and multiple forms are the norm if
      you have floating frames.

      1. 790-js-workaround.txt
        2 kB
        mdirkse
      2. changebundle.txt
        7 kB
        frederickkaempfer
      3. changebundle.txt
        6 kB
        frederickkaempfer
      4. ExtendedViewHandler.java
        5 kB
        sharath.naik

        Issue Links

          Activity

          Hide
          stiemannkj1 added a comment -

          Here's my current work on this if anyone wants to look it over (unfortunately the diff is kinda ugly): https://github.com/stiemannkj1/mojarra/commit/e8f7f196636c17fe87e870030626d38a49be23fc. I still need to test this in both webapps and portlets for ViewState and ClientWindow. I also need to make the style more consistent (tabs vs. spaces) etc. So it's not quite ready yet, but hopefully it will be by Monday.

          Branch on github: https://github.com/stiemannkj1/mojarra/tree/fix-render-%40all-JSF-SPEC-790

          Show
          stiemannkj1 added a comment - Here's my current work on this if anyone wants to look it over (unfortunately the diff is kinda ugly): https://github.com/stiemannkj1/mojarra/commit/e8f7f196636c17fe87e870030626d38a49be23fc . I still need to test this in both webapps and portlets for ViewState and ClientWindow . I also need to make the style more consistent (tabs vs. spaces) etc. So it's not quite ready yet, but hopefully it will be by Monday. Branch on github: https://github.com/stiemannkj1/mojarra/tree/fix-render-%40all-JSF-SPEC-790
          Hide
          stiemannkj1 added a comment -

          Here's a better diff with the tabs converted to spaces: https://github.com/stiemannkj1/mojarra/commit/1a8993c9f6ae2857c0310f6600dc0ea82ed56c26. Hopefully that's clearer.

          Show
          stiemannkj1 added a comment - Here's a better diff with the tabs converted to spaces: https://github.com/stiemannkj1/mojarra/commit/1a8993c9f6ae2857c0310f6600dc0ea82ed56c26 . Hopefully that's clearer.
          Hide
          stiemannkj1 added a comment -

          I think I've finished the code, but I'm having some trouble with HtmlUnit tests. Gonna work more on this tomorrow, but you can see the diff here: https://github.com/javaserverfaces/mojarra/compare/26174a11...stiemannkj1:fix-render-@all-JSF-SPEC-790?expand=1

          Show
          stiemannkj1 added a comment - I think I've finished the code, but I'm having some trouble with HtmlUnit tests. Gonna work more on this tomorrow, but you can see the diff here: https://github.com/javaserverfaces/mojarra/compare/26174a11...stiemannkj1:fix-render-@all-JSF-SPEC-790?expand=1
          Hide
          balusc added a comment - - edited

          I will look at it once I'm finished with 1396.

          Show
          balusc added a comment - - edited I will look at it once I'm finished with 1396.
          Hide
          stiemannkj1 added a comment - - edited

          Okay I think this is complete now, but I have some failing tests which I still need to check on:

          servlet30/ajax
          servlet30/systest
          javaee8/importConstants
          javaee7/multiFieldValidation
          

          Not sure if those failures are my fault yet. vsingleton, can you check if those failures occur in master? If not, I will debug them tomorrow.

          See changes here: https://github.com/stiemannkj1/mojarra/tree/fix-render-@all-JSF-SPEC-790

          Note that I had to tell JUnit to @ignore my tests since they require HtmlUnit 2.24-SNAPSHOT due to https://sourceforge.net/p/htmlunit/bugs/1815/ (the tests do pass with 2.24-SNAPSHOT though).

          Show
          stiemannkj1 added a comment - - edited Okay I think this is complete now, but I have some failing tests which I still need to check on: servlet30/ajax servlet30/systest javaee8/importConstants javaee7/multiFieldValidation Not sure if those failures are my fault yet. vsingleton , can you check if those failures occur in master ? If not, I will debug them tomorrow. See changes here: https://github.com/stiemannkj1/mojarra/tree/fix-render-@all-JSF-SPEC-790 Note that I had to tell JUnit to @ignore my tests since they require HtmlUnit 2.24-SNAPSHOT due to https://sourceforge.net/p/htmlunit/bugs/1815/ (the tests do pass with 2.24-SNAPSHOT though).

            People

            • Assignee:
              balusc
              Reporter:
              werpu12
            • Votes:
              59 Vote for this issue
              Watchers:
              45 Start watching this issue

              Dates

              • Created:
                Updated:

                Time Tracking

                Estimated:
                Original Estimate - 5 days
                5d
                Remaining:
                Remaining Estimate - 5 days
                5d
                Logged:
                Time Spent - Not Specified
                Not Specified