7 Replies Latest reply on Aug 4, 2011 11:55 AM by kriss_96

    RichFaces can't save, too many bean new instances.

    kriss_96

      Hi, I have a problem. I want to show editable information to the user with a modal panel. I have also a "Save" button that saves the edited information. All this information are in a Bean.

       

      The problem is that when I open the modal panel a new instance of the bean it's created (it's ok), but when I click on the "save" button an other instance of the bean it's created, so the saved bean it's empty.

       

      I have tried the a4j:keepAlive tag, but I got an exception during line processing ( I think I've didn't put it in the right place).

       

       

      Here's the code :

       

       

      <rich:modalPanel id="licenseCustomerDetailPanel" autosized="true" top="80%">

                  <f:facet name="header">

                      <h:panelGroup>

                          <h:outputText value="#{labels.licenseCustomerDetail}" />

                      </h:panelGroup>

                  </f:facet>

                  <f:facet name="controls">

                      <h:panelGroup>

                          <h:graphicImage value="/images/icons/close_tab_red.png" id="hideLicenseCustomerDetailPanel" />

                          <rich:componentControl for="licenseCustomerDetailPanel" attachTo="hideLicenseCustomerDetailPanel" operation="hide" event="onclick" />

                      </h:panelGroup>

                  </f:facet>

                 

                  <a4j:form ajaxSubmit="true">

                      <h:panelGrid id="licenseCustomerPanelGrid" width="650" >

                          <rich:panel>

                              <h:panelGrid columns="2" width="600">

                                  <h:outputText value="#{labels.name} : " styleClass='tdTitleStyleClass' />

                                  <h:inputText value="#{licenseRequestBean.licenseCustomerDetailBean.name}" disabled = "true"  />

       

                                  <h:outputText value="#{labels.contactName} : " styleClass='tdTitleStyleClass' />

                                  <h:inputText value="#{licenseRequestBean.licenseCustomerDetailBean.contactName}" />

       

                                  <h:outputText value="#{labels.email} : " styleClass='tdTitleStyleClass' />

                                  <h:inputText value="#{licenseRequestBean.licenseCustomerDetailBean.email}" />

       

                                  <h:outputText value="#{labels.contactJob} : " styleClass='tdTitleStyleClass' />

                                  <h:inputText value="#{licenseRequestBean.licenseCustomerDetailBean.contactJob}" />

       

                                  <h:outputText value="#{labels.street} : " styleClass='tdTitleStyleClass' />

                                  <h:inputText value="#{licenseRequestBean.licenseCustomerDetailBean.street}" />

       

                                  <h:outputText value="#{labels.city} : " styleClass='tdTitleStyleClass' />

                                  <h:inputText value="#{licenseRequestBean.licenseCustomerDetailBean.city}" />

       

                                  <h:outputText value="#{labels.country} : " styleClass='tdTitleStyleClass' />

                                  <h:inputText value="#{licenseRequestBean.licenseCustomerDetailBean.country}" />

       

                                  <h:outputText value="#{labels.countryISO} : " styleClass='tdTitleStyleClass' />

                                  <h:inputText value="#{licenseRequestBean.licenseCustomerDetailBean.countryISO}" />

       

                                  <h:outputText value="#{labels.zipCode} : " styleClass='tdTitleStyleClass' />

                                  <h:inputText value="#{licenseRequestBean.licenseCustomerDetailBean.zipCode}" />

       

                                  <h:outputText value="#{labels.phoneNumber} : " styleClass='tdTitleStyleClass' />

                                  <h:inputText value="#{licenseRequestBean.licenseCustomerDetailBean.phoneNumber}" />

       

                                  <h:outputText value="#{labels.comment} : " styleClass='tdTitleStyleClass' />

                                  <h:inputText value="#{licenseRequestBean.licenseCustomerDetailBean.comment}" />

                              </h:panelGrid>

                          </rich:panel>

                      </h:panelGrid>

                      <rich:toolBar height="34" itemSeparator="line">

                          <rich:toolBarGroup location="right">

                              <a4j:commandButton value="#{labels.save}" action="#{licenseRequestBean.saveLicenseCustomerBean}" id="saveLicenseCustomerDetailButton" image="/images/icons/filesave.png">

                                  <rich:toolTip showDelay="2000">

                                      <span style="white-space: nowrap"><strong><h:outputText value="#{labels.save}" /></strong></span>

                                  </rich:toolTip>

                                  <rich:componentControl for="licenseCustomerDetailPanel" attachTo="saveLicenseCustomerDetailButton" operation="hide" event="onclick" />

                              </a4j:commandButton>

                          </rich:toolBarGroup>

                      </rich:toolBar>

                  </a4j:form>

              </rich:modalPanel>

      Thanks