ICEfaces
  1. ICEfaces
  2. ICE-6896

Null-value not updated in rendered view

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: EE-2.0.0.GA
    • Fix Version/s: 2.1-Beta, 3.0, EE-2.0.0.GA_P01
    • Component/s: None
    • Labels:
      None
    • Environment:
      Mojarra 2.1.1-b04
    • Assignee Priority:
      P2
    • Affects:
      Compatibility/Configuration
    • Workaround Exists:
      Yes
    • Workaround Description:
      I the value is set to an empty string the result is as expected. But that's no real option for us as we are already using nulls everywhere.

      Description

      Given this form:

      <h:form id="myForm">
      <h:inputText id="myInput" value="#{myBean.myValue}"/>

      <h:commandButton id="submitButton" action="#{myBean.submit}" value="Submit"/>
      </h:form>

      and this action mehod:

      public String submit() {
        myValue = null;

      return null;
      }

      the user expects the textfield to be empty after the request finished.

      This works with plain Mojarra (org.icefaces.render.auto = false) but not with ICEfaces.

      I think the problem is that TextRenderer.getEndTextToRender() doesn't call the ResponseWriter if the value is null.

        Activity

        Adrian Gygax created issue -
        Hide
        Adrian Gygax added a comment -

        Attached an Eclipse 3.6 project with a sample application.

        To reproduce the bug:

        Open http://localhost:8080/icefacesSupport/
        Enter any text into the textfield
        Press the button
        -> The text is still there

        In web.xml switch org.icefaces.render.auto to "false" and do the same again
        -> The textbox is empty

        Show
        Adrian Gygax added a comment - Attached an Eclipse 3.6 project with a sample application. To reproduce the bug: Open http://localhost:8080/icefacesSupport/ Enter any text into the textfield Press the button -> The text is still there In web.xml switch org.icefaces.render.auto to "false" and do the same again -> The textbox is empty
        Adrian Gygax made changes -
        Field Original Value New Value
        Attachment icefacesSupportEclipseProject.zip [ 13255 ]
        Tyler Johnson made changes -
        Salesforce Case [5007000000Gv9WV]
        Ken Fyten made changes -
        Fix Version/s EE-2.0.0.GA_P01 [ 10271 ]
        Fix Version/s 2.1 [ 10241 ]
        Affects [Compatibility/Configuration]
        Assignee Priority P2
        Assignee Mark Collette [ mark.collette ]
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #24899 Fri Jun 24 18:29:09 MDT 2011 mark.collette ICE-6896 : Null-value not updated in rendered view
        Files Changed
        Commit graph MODIFY /icefaces2/trunk/icefaces/core/src/main/java/org/icefaces/impl/context/DOMPartialViewContext.java
        Hide
        Mark Collette added a comment -

        When the user submits the form, DomPartialViewContext.applyBrowserChanges should be updating the old DOM to contain the submitted text, so that the DOM difference will see the submitted value in the old DOM, and the cleared value in the new DOM, and then tell the browser about the new cleared state. But there's some special logic in applyBrowserChanges that's keeping the old DOM from being updated.

        if ("".equals(value))

        { inputElement.setAttribute("value", ""); }

        else {
        if (inputElement.hasAttribute("value"))

        { // <== Problem is here inputElement.setAttribute("value", value); }

        else if (inputElement.getAttribute("type").equals("checkbox"))

        { inputElement.setAttribute("checked", "checked"); }

        }

        When the inputText was first rendered, it had no text value, so no value attribute was rendered. So when the user submitted a value, this code kept the value from being updated. The hasAttribute("value") check is from ICE-2727. It looks like it was an optimisation for ice:commandButton. When I tested with the hasAttribute("value") removed, the DOM difference worked properly, and the page updated as expected. Added an ice:commandButton to the form to be sure that it was not being updated, to ensure ICE-2727 was still being covered.

        Show
        Mark Collette added a comment - When the user submits the form, DomPartialViewContext.applyBrowserChanges should be updating the old DOM to contain the submitted text, so that the DOM difference will see the submitted value in the old DOM, and the cleared value in the new DOM, and then tell the browser about the new cleared state. But there's some special logic in applyBrowserChanges that's keeping the old DOM from being updated. if ("".equals(value)) { inputElement.setAttribute("value", ""); } else { if (inputElement.hasAttribute("value")) { // <== Problem is here inputElement.setAttribute("value", value); } else if (inputElement.getAttribute("type").equals("checkbox")) { inputElement.setAttribute("checked", "checked"); } } When the inputText was first rendered, it had no text value, so no value attribute was rendered. So when the user submitted a value, this code kept the value from being updated. The hasAttribute("value") check is from ICE-2727 . It looks like it was an optimisation for ice:commandButton. When I tested with the hasAttribute("value") removed, the DOM difference worked properly, and the page updated as expected. Added an ice:commandButton to the form to be sure that it was not being updated, to ensure ICE-2727 was still being covered.
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #24900 Fri Jun 24 21:06:37 MDT 2011 mark.collette ICE-6896 : Null-value not updated in rendered view
        Files Changed
        Commit graph MODIFY /icefaces2/branches/icefaces-2.0.x-maintenance/icefaces/core/src/main/java/org/icefaces/impl/context/DOMPartialViewContext.java
        Hide
        Mark Collette added a comment -

        trunk
        Subversion 24899

        icefaces2/branches/icefaces-2.0.x-maintenance/icefaces
        Subversion 24900

        Show
        Mark Collette added a comment - trunk Subversion 24899 icefaces2/branches/icefaces-2.0.x-maintenance/icefaces Subversion 24900
        Mark Collette made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Ken Fyten made changes -
        Fix Version/s 2.1-Beta [ 10291 ]
        Ken Fyten made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Mark Collette
            Reporter:
            Adrian Gygax
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: