3 Replies Latest reply on Feb 29, 2012 10:29 PM by gerleotta

    I need null values in the model from empty fields form view

    gerleotta Newbie

      Hello, I'm working with Seam 3 and Seam Faces module. I've noticed that when I do a submit of empty fields from a html page these are not converted to null in the model.

      For example:



      file: PersonFinder.java



      public class PersonFinder {



                private String name;

                private Long age;




                //public getters and setters



                public void find() {

                          //find logic








      file: personFinder.xhtml




      <h:panelGrid columns="3" cellpadding="2px" width="100%;" id="dataFilter">

                <h:outputText value="Nombre" />

                <h:outputText value="age" />

                <h:inputText value="#{personFinder.name}"

                          id="filterName" />

                <h:inputText value="#{personFinder.age}"

                          id="filterAge" />


      <div align="right">

                <h:commandButton value="Searcj" styleClass="button button-narrow" action="#{personFinder.find}">

                          <f:ajax execute="dataFilter" render="clientList"/>







      when I submit the above form with empty fields filterAge filterName, PersonFinder attributes are written with name = "" and age = 0.



      I've tried using custom converters but the original values ??are rewritten for org.apache.el.parser.AstValue Class



      Is it okay that's the default behavior of seam?

      How I can do to my backinbean reach null values of empty fields?



      Thank you in advance.