1. facelets
  2. FACELETS-357

When using ui:repeat and inputText with attributes that are 'nullable' (for example date attributes) they cannot be set to null by entering an empty String ("")


    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: UNKNOWN
    • Fix Version/s: 1.1.15
    • Component/s: impl
    • Labels:
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:


      (Affected Facelets Version is 1.1.15.B1)
      When using ui:repeat in conjunction with an input field and a attribute with a
      type that can normally be set to null by a user (for example a date) by entering
      an empty string into the input field (""), it is not possible for the user to do
      so. A small example:


      public class TestBean {
      public List testEntries=new LinkedList();
      public TestBean()

      { testEntries.add(new TestEntry()); }

      public class TestEntry implements Serializable{
      private Date testAttribute;

      public Date getTestAttribute()

      { return testAttribute; }

      public void setTestAttribute(Date testAttribute)

      { System.out.println("set:"+testAttribute); this.testAttribute = testAttribute; }

      public List getEntries()

      { return testEntries; }


      test.xhtml (excerpt):

      <ui:repeat value="#


      " var="entry">
      <h:inputText value="#


      <f:convertDateTime type="date" dateStyle="medium"/>

      When you now enter a Date (lets say 1/1/2009) it is accepted and set. If you try
      to set the date to null by entering an empty string into the input field, it
      gets set to its initial value (1/1/2009).

      The problem happens in the "populate" method of UIRepeat.SavedState . It uses
      "getValue" to get the current component value after the value was already set to
      null. The "getValue" method itself will then try to get a value from the value
      it is bind to instead, which is, at that state, still filled with the old data
      (1/1/2009) and returns this value. When the "apply" Method is fired afterwards
      the old value is then written again to the component value and the value binding
      won't get updated with the null value. Using "getLocalValue" instead of
      "getValue" seems to solve the problem:

      public void populate(EditableValueHolder evh) {
      this.value = evh.getLocalValue();
      this.valid = evh.isValid();
      this.submittedValue = evh.getSubmittedValue();
      this.localValueSet = evh.isLocalValueSet();


        There are no comments yet on this issue.


          • Assignee:
          • Votes:
            2 Vote for this issue
            0 Start watching this issue


            • Created: