6 Replies Latest reply on Apr 14, 2010 7:32 AM by nbelaevski

    Support for updating object

    mvdurao

      I need help updating an object in my bean. I'm calling with
      <a4j:support action="#{produtoFc.adicionarPreco}" event="onclick" immediate="true" reRender="valorProduto,tblPrecos"/>.<

      But when I check the bean objects are null.

       

      Some can help me in this solution

        • 1. Re: Support for updating object
          jbalunas

           

          I am going to move this to the RichFaces forum, the RichFaces Development forum is for discussions related to the development of RichFaces project itself.  You will share your question and any answers with more people from the community in the user forum.

           

          Thanks

          • 2. Re: Support for updating object
            nbelaevski

            Immediate command components fully skip UPDATE_MODEL_VALUES phase, so this can be the reason of "null bean objects". Try changing this and post more page/bean code if this won't help.

            • 3. Re: Support for updating object
              mvdurao

              so I'm using this method to add items to an application in a grid. So I put the Immediate. Because there may be null fields in the header of the note.

               

              Code:

               

                               <h:graphicImage value="../../imagens/icons/add.png" id="btnAddPreco">
                                                                 <rich:toolTip>
                                                                  <span style="white-space:nowrap">
                                                                      <h:outputLabel value="#{msgs.produto_preco_adicionar}" />
                                                                  </span>
                                                              </rich:toolTip>
                                                              <a4j:support action="#{produtoFc.adicionarPreco}" 
                                                                           event="onclick"                                                            
                                                                           immediate="true"
                                                                           reRender="valorProduto,tblPrecos"/>                                       
                                                             </h:graphicImage>

               

               

              Bean

               

              public void adicionarPreco() {

               

                      List<Produto_TabelaPreco> precos = new ArrayList<Produto_TabelaPreco>();
                     
                      try {
                          Produto_TabelaPreco preco = new Produto_TabelaPreco();
                         
                          if (produto.getPrecos() != null ) {
                              precos = produto.getPrecos();
                          }
                         
                          preco.setValor(this.valorProduto);
                          preco.setTabelapreco(this.tabelaPreco);
                          preco.setProduto(produto);
                          precos.add(preco);
                         
                          produto.setPrecos(precos);

               

                          this.valorProduto = new Double(0);
                         
                      } catch (Exception e) {
                          System.out.println(e);
                      }
                  }

              • 4. Re: Support for updating object
                nbelaevski

                Marcus,

                 

                The problem is still not clear to me:

                 

                - what bean values are missing?

                - why do you need immediate at all?

                - was immediate="true" the source of the problem?

                • 5. Re: Support for updating object
                  mvdurao

                  Belaevski,

                   

                  My problem is I need to add prices for a product.
                  To do this routine I created a button that adds values in one table without the submit page.

                   

                  I created a method that takes the values and add to the collection and make a reRender in the table.

                   

                  This method can not validate the form information so I used the immediate.

                   

                  Except that when I used the immediate is not sending the values to the bean.

                   

                  Below the screen image.

                   

                  Thank you for your attention

                  • 6. Re: Support for updating object
                    nbelaevski

                    The problem is still not clear. Please post more bean & page code and point to the problem.