ICEfaces
  1. ICEfaces
  2. ICE-5981

Markup rendered by FormRenderer causes D2D DOM-diff after first partial submit

    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: None
    • Labels:
      None
    • Environment:
      Liferay 6.0.4 + PortletFaces-Bridge 2.0.0-BETA1 + ICEfaces 2.0 trunk revision 22133

      Description

      Please refer to the attached portlet for a way to reproduce this one.

      When the view is initially rendered with an HTTP-GET, the following <form> appears in the rendered markup of the page:


      <form name="v31jf08" method="post" id="v31jf08" action="http://localhost:8080/web/guest/ice2?_1_WAR_icefaces2xcompatportlet_INSTANCE_Fpb4__facesViewId=%2Fxhtml%2FportletViewMode.xhtml&amp;p_auth=nFDd6uMq&amp;p_p_col_count=1&amp;p_p_col_id=column-1&amp;p_p_id=1_WAR_icefaces2xcompatportlet_INSTANCE_Fpb4&amp;p_p_lifecycle=1&amp;p_p_mode=view&amp;p_p_state=normal">
      <input type="hidden" value="v31jf08" name="v31jf08">
      <input type="hidden" value="http://localhost:8080/web/guest/ice2?p_p_cacheability=cacheLevelPage&amp;p_p_col_count=1&amp;p_p_col_id=column-1&amp;p_p_id=1_WAR_icefaces2xcompatportlet_INSTANCE_Fpb4&amp;p_p_lifecycle=2&amp;p_p_mode=view&amp;p_p_state=normal" name="javax.faces.encodedURL">
      <span id="v31jf08hdnFldsDiv">
      <input type="hidden" name="1360817547:f2:j_idcl">
      <input type="hidden" name="1360817547:f2:j_id1360817547:f2:dateOfBirthsp">
      </span>
      <input type="hidden" autocomplete="off" value="-5481536192991678120:-511719377066662166" id="javax.faces.ViewState" name="javax.faces.ViewState">
      </form>

      But after typing "32801" in the PostalCode field, the DOM-replacement is this:


      <form action="http://localhost:8080/web/guest/ice2?_1_WAR_icefaces2xcompatportlet_INSTANCE_Fpb4__facesViewId=%2Fxhtml%2FportletViewMode.xhtml&amp;p_auth=nFDd6uMq&amp;p_p_col_count=1&amp;p_p_col_id=column-1&amp;p_p_id=1_WAR_icefaces2xcompatportlet_INSTANCE_Fpb4&amp;p_p_lifecycle=1&amp;p_p_mode=view&amp;p_p_state=normal" id="v31jf08" method="post" name="v31jf08">
      <input name="v31jf08" type="hidden" value="v31jf08" />
      <input name="javax.faces.encodedURL" type="hidden" value="http://localhost:8080/web/guest/ice2?p_p_cacheability=cacheLevelPage&amp;p_p_col_count=1&amp;p_p_col_id=column-1&amp;p_p_id=1_WAR_icefaces2xcompatportlet_INSTANCE_Fpb4&amp;p_p_lifecycle=2&amp;p_p_mode=view&amp;p_p_state=normal" />
      <input autocomplete="off" id="javax.faces.ViewState" name="javax.faces.ViewState" type="hidden" value="-5481536192991678120:-511719377066662166" />
      <span id="v31jf08hdnFldsDiv">
      <input name="1360817547:f2:j_idcl" type="hidden" />
      <input name="1360817547:f2:j_id1360817547:f2:dateOfBirthsp" type="hidden" />
      </span>
      </form>

      Even though the form is essentially the same, the order of elements, and the order of attributes on elements is different. This is causing a DOM-diff of the form and an unnecessary incremental page update.

        Activity

        Neil Griffin created issue -
        Neil Griffin made changes -
        Field Original Value New Value
        Attachment icefaces-2.x-compat-portlet-1.0.0-SNAPSHOT.war [ 12492 ]
        Neil Griffin made changes -
        Assignee Ted Goddard [ ted.goddard ]
        Hide
        Ted Goddard added a comment -

        It looks like the cause of the diff is the javax.faces.ViewState moving within the form. I will reproduce and investigate.

        Show
        Ted Goddard added a comment - It looks like the cause of the diff is the javax.faces.ViewState moving within the form. I will reproduce and investigate.
        Ted Goddard made changes -
        Salesforce Case []
        Fix Version/s 2.0-Beta2 [ 10242 ]
        Hide
        Neil Griffin added a comment -

        The attribute ordering of the form is different too.

        Before: <form name="..." method="..." id="..." action="...">

        After: <form action="..." id="v31jf08" method="..." name="...">

        Show
        Neil Griffin added a comment - The attribute ordering of the form is different too. Before: <form name="..." method="..." id="..." action="..."> After: <form action="..." id="v31jf08" method="..." name="...">
        Hide
        Ted Goddard added a comment -

        It's true that the attribute ordering is different, but this is not a significant difference from the point of view of the DOM diff – attributes are checked for their existence, but the order is not a factor.

        Show
        Ted Goddard added a comment - It's true that the attribute ordering is different, but this is not a significant difference from the point of view of the DOM diff – attributes are checked for their existence, but the order is not a factor.
        Hide
        Neil Griffin added a comment -

        ah, good to know, thanks!

        Show
        Neil Griffin added a comment - ah, good to know, thanks!
        Hide
        Ted Goddard added a comment -

        Problem reproduced with provided .war file. Will test again with updated binaries.

        Show
        Ted Goddard added a comment - Problem reproduced with provided .war file. Will test again with updated binaries.
        Hide
        Ted Goddard added a comment -

        Updating icefaces jar files produces the following exception:

        16:27:28,521 ERROR [jsp:154] java.lang.IllegalStateException: Component ID 1326672783:f2:f2_viewstate has already been found in the view.
        at com.sun.faces.util.Util.checkIdUniqueness(Util.java:820)
        at com.sun.faces.util.Util.checkIdUniqueness(Util.java:804)
        at com.sun.faces.util.Util.checkIdUniqueness(Util.java:804)
        at com.sun.faces.application.view.StateManagementStrategyImpl.saveView(StateManagementStrategyImpl.java:134)

        Show
        Ted Goddard added a comment - Updating icefaces jar files produces the following exception: 16:27:28,521 ERROR [jsp:154] java.lang.IllegalStateException: Component ID 1326672783:f2:f2_viewstate has already been found in the view. at com.sun.faces.util.Util.checkIdUniqueness(Util.java:820) at com.sun.faces.util.Util.checkIdUniqueness(Util.java:804) at com.sun.faces.util.Util.checkIdUniqueness(Util.java:804) at com.sun.faces.application.view.StateManagementStrategyImpl.saveView(StateManagementStrategyImpl.java:134)
        Hide
        Ted Goddard added a comment -

        Provided .war file contains two copies of mojarra, which may be a problem:

        1870646 08-09-10 20:17 WEB-INF/lib/jsf-impl-2.0.3-FCS.jar
        1878770 08-09-10 17:32 WEB-INF/lib/jsf-impl-2.0.4-b01.jar

        Show
        Ted Goddard added a comment - Provided .war file contains two copies of mojarra, which may be a problem: 1870646 08-09-10 20:17 WEB-INF/lib/jsf-impl-2.0.3-FCS.jar 1878770 08-09-10 17:32 WEB-INF/lib/jsf-impl-2.0.4-b01.jar
        Hide
        Neil Griffin added a comment -

        Ya I noticed that last night. This is due to the ICEfaces 2.0 POM requiring 2.0.3-FCS and the bridge POM requiring 2.0.4-b01. This should be resolved when we sync up on the next release of Mojarra by Oracle.

        Show
        Neil Griffin added a comment - Ya I noticed that last night. This is due to the ICEfaces 2.0 POM requiring 2.0.3-FCS and the bridge POM requiring 2.0.4-b01. This should be resolved when we sync up on the next release of Mojarra by Oracle.
        Hide
        Ted Goddard added a comment -

        The multiple JSF .jars do not appear to be the source of the problem.

        BridgeSetup.java adds a form to the page for retrieveUpdateSetup. ExtrasSetup.java adds *hdnFieldsDiv to all forms. The interaction between these two SystemEventListeners appears to behave differently during initial page view and ajax updates, resulting in different placement of javax.faces.ViewState.

        Since this DOM update does not affect a visible form, it is likely harmless (from the user's point of view), but inefficient.

        Show
        Ted Goddard added a comment - The multiple JSF .jars do not appear to be the source of the problem. BridgeSetup.java adds a form to the page for retrieveUpdateSetup. ExtrasSetup.java adds *hdnFieldsDiv to all forms. The interaction between these two SystemEventListeners appears to behave differently during initial page view and ajax updates, resulting in different placement of javax.faces.ViewState. Since this DOM update does not affect a visible form, it is likely harmless (from the user's point of view), but inefficient.
        Hide
        Ted Goddard added a comment -

        Assigning to Mircea to fix for 2.0 (not essential for beta2). Neil, please let us know if this fix is actually critical for Portlet support and we can re-prioritize for beta2.

        Show
        Ted Goddard added a comment - Assigning to Mircea to fix for 2.0 (not essential for beta2). Neil, please let us know if this fix is actually critical for Portlet support and we can re-prioritize for beta2.
        Ted Goddard made changes -
        Salesforce Case []
        Fix Version/s 2.0.0 [ 10230 ]
        Fix Version/s 2.0-Beta2 [ 10242 ]
        Assignee Ted Goddard [ ted.goddard ] Mircea Toma [ mircea.toma ]
        Hide
        Neil Griffin added a comment -

        The issue is not essential, not critical for portlet support. It is indeed harmless (from the user's point of view). The inefficiency only happens on the first paritalSubmit, and not thereafter.

        Show
        Neil Griffin added a comment - The issue is not essential, not critical for portlet support. It is indeed harmless (from the user's point of view). The inefficiency only happens on the first paritalSubmit, and not thereafter.
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #22988 Mon Nov 01 08:13:34 MDT 2010 mircea.toma ICE-5981 Stop rendering ViewState input hidden field during postback to avoid forcing DOM update for the parent 'form' element.
        Files Changed
        Commit graph MODIFY /icefaces2/trunk/icefaces/core/src/main/java/org/icefaces/impl/event/BridgeSetup.java
        Hide
        Mircea Toma added a comment -

        Removed code that was rendering ViewState input hidden field during postback. This stops ICEfaces from generating an update for the parent 'form' element. In case the form is updated the ViewState input element is restored by the bridge (see ICE-5691 ).

        Show
        Mircea Toma added a comment - Removed code that was rendering ViewState input hidden field during postback. This stops ICEfaces from generating an update for the parent 'form' element. In case the form is updated the ViewState input element is restored by the bridge (see ICE-5691 ).
        Mircea Toma made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Ken Fyten made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Mircea Toma
            Reporter:
            Neil Griffin
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: