1 Reply Latest reply on Jan 7, 2011 8:18 AM by Aldo Bonzi

    Field values not binding?

    Marcos Maia Newbie


      I am buildina a simple research routine whith 2 date fields a selectOneMenu and a button:

      <h:form id="pesquisaAbastecimentoForm">
                     <s:decorate id="dataInicialField" template="../layout/edit.xhtml">
                          <ui:define name="label" id="labelDataInicial">Data Inicial</ui:define>
                          <rich:calendar id="dataInicial" value="#{abastecimentoAction.dataInicialPesquisa}"
                               datePattern="dd/MM/yyyy HH:mm" />
                     <s:decorate id="dataFinalField" template="../layout/edit.xhtml">
                          <ui:define name="label" id="labalDataFinal">Data Final</ui:define>
                          <rich:calendar id="dataFinal" value="#{abastecimentoAction.dataFinalPesquisa}"
                               datePattern="dd/MM/yyyy HH:mm" />
                     <s:decorate id="carroField" template="../layout/edit.xhtml">
                          <ui:define name="label">Carro</ui:define>
                          <h:selectOneMenu value="#{abastecimentoAction.idCarroPesquisa}" required="false">
                               <s:selectItems var="carro" value="#{carroList.resultList}" label="#{carro.nome}" itemValue="#{carro.id}" />
                     <s:div styleClass="actionButtons">
                          <s:button action="#{abastecimentoAction.pesquisaAbasatecimentos}" id="pesquisaAbastecimentos" value="Pesquisar Abastecimento">

      And I have a seam component which should get the values and get the method pesquisaAbastecimentos executed.

      public class AbastecimentoAction implements Serializable {
           private static final long serialVersionUID = -2008939547568730028L;
           Log log;
           EntityManager entityManager;
           User user;
           //variáveis para pesquisa do abastecimento
           private Date dataInicialPesquisa;
           private Date dataFinalPesquisa;
           private int idCarroPesquisa;
           List<AbastecimentoMensal> listaAbastecimentoMensal;
           public void pesquisaAbasatecimentos() { ... }
      public Date getDataInicialPesquisa() {
                return dataInicialPesquisa;
           public void setDataInicialPesquisa(Date dataInicialPesquisa) {
                this.dataInicialPesquisa = dataInicialPesquisa;
           public Date getDataFinalPesquisa() {
                return dataFinalPesquisa;
           public void setDataFinalPesquisa(Date dataFinalPesquisa) {
                this.dataFinalPesquisa = dataFinalPesquisa;
           public int getIdCarroPesquisa() {
                return idCarroPesquisa;
           public void setIdCarroPesquisa(int idCarroPesquisa) {
                this.idCarroPesquisa = idCarroPesquisa;

      The method is correctly executed but the values for the fields are never populated. As I am relatively new to seam I could not find out why these fields are not being correctly filled by seam framework. The values are actually null and 0 when the button is pressed and the


      method is executed. Any clues?