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

    Field values not binding?

    Marcos Maia Newbie

      Hi,


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




      <h:form id="pesquisaAbastecimentoForm">
      <table>
           <tr>
                <td>
                     <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>
                     <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>                                   
                </td>
                <td>
                     <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}" />
                          </h:selectOneMenu>
                     </s:decorate>
                     <s:div styleClass="actionButtons">
                          <s:button action="#{abastecimentoAction.pesquisaAbasatecimentos}" id="pesquisaAbastecimentos" value="Pesquisar Abastecimento">
                          </s:button>
                     </s:div>
                </td>
           </tr>
      </table>
      </h:form>
      



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





      @Name("abastecimentoAction")
      @Scope(ScopeType.CONVERSATION)
      public class AbastecimentoAction implements Serializable {
      
           private static final long serialVersionUID = -2008939547568730028L;
      
           @Logger
           Log log;
      
           @In
           EntityManager entityManager;
      
           @In
           User user;
           
           //variáveis para pesquisa do abastecimento
           private Date dataInicialPesquisa;
           private Date dataFinalPesquisa;
           private int idCarroPesquisa;
           
           @DataModel
           List<AbastecimentoMensal> listaAbastecimentoMensal;
      
           @SuppressWarnings("unchecked")
           @Create
           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


      #{abastecimentoAction.pesquisaAbasatecimentos}



      method is executed. Any clues?


      regards.