0 Replies Latest reply on Jun 20, 2007 6:32 PM by Jose Miguel Loor

    How to a4j:keepAlive

    Jose Miguel Loor Apprentice

      Hi

      I don't know if i am using a4j:keepAlive in the correct manner, but it seems to me that it is not storing the values in the way it should

      Let's assume this

      <a4j:keepAlive beanName="modulosFormasDataManager" />
      <h:form>
      <rich:tabPanel>
       <rich:tab id="modulosTab" label="Modulos" actionListener="#{modulosFormasController.tabActionListener}">
       <rich:dataTable id="modulosDataTable" binding="#{modulosFormasController.modulosDataTable}" value="#{modulosFormasDataManager.modulos}" var="item" cellspacing="0" cellpadding="2" styleClass="cb-rich-table" headerClass="headerCell" columnClasses="headerCell,dataCell,dataCell,dataCell,dataCell,dataCell,dataCell" rowKeyVar="row">
       <rich:column id="moduleRowColumn" style="width:20px">
       <f:facet name="header"><h:outputText value=" " escape="false"/></f:facet>
       <h:outputText id="moduleRowNumber" value="#{row+1}" />
       </rich:column>
       <rich:column id="moduleNameColumn">
       <f:facet name="header"><h:outputText value="Módulo" escape="false"/></f:facet>
       <h:outputText id="moduleName" value="#{item.nombre}" />
       </rich:column>
       <rich:column id="moduleStateColumn">
       <f:facet name="header"><h:outputText value="Estado" escape="false"/></f:facet>
       <h:outputText id="moduleState" value="#{item.estado}" />
       </rich:column>
       <rich:column id="moduleResponsibleColumn">
       <f:facet name="header"><h:outputText value="Responsable" escape="false"/></f:facet>
       <h:outputText id="moduleResponsible" value="#{item.responsable}" />
       </rich:column>
       <a4j:support id="moduleSelectRowSupport" event="onRowClick" data="#{modulosFormasDataManager.selectedModulo}" actionListener="#{modulosFormasController.selectRowListener}" onsubmit="setSelectedRow(this)" oncomplete="alert(data);" />
       </rich:dataTable>
       </rich:tab>
      <rich:tab>
      some other code
      </rich:tab>
      </rich:tabPanel>
      


      the modulosFormasDataManager is a request scoped bean that has some properties to work with my data; basically is just a data holder; it is also a managed property of the page backing bean

       <managed-bean>
       <managed-bean-name>modulosFormasDataManager</managed-bean-name>
       <managed-bean-class>com.casabaca.administration.web.common.ModulosFormasDataManager</managed-bean-class>
       <managed-bean-scope>request</managed-bean-scope>
       </managed-bean>
      
       <managed-bean>
       <managed-bean-name>modulosFormasController</managed-bean-name>
       <managed-bean-class>com.casabaca.administration.web.controller.ModulosFormasController</managed-bean-class>
       <managed-bean-scope>request</managed-bean-scope>
       <managed-property>
       <property-name>modulosFormasDataManager</property-name>
       <property-class>com.casabaca.administration.web.common.ModulosFormasDataManager</property-class>
       <value>#{modulosFormasDataManager}</value>
       </managed-property>
       </managed-bean>
      


      the ModulosFormasDataManager bean has a property named selectedRow, so when i click on a row of the table, i use an actionListener to define that property from the rowData of the dataTable. I assume that if i click on a row and set the value properly in the modulosFormasDataManager, and then i click in the other tab the selectedRow of the modulosFormasDataManager must be present but it is not, the property is null

      even more, if i click on a row, i assume the value is setted in modulosFormasDataManager.selectedRow and stays there for as long i remain in the page; but if i click in another row and check the last value of the selectedRow property it is always null

      Am i missunderstanding the use of the a4j:keepAlive ??? how is it suppossed to be used ??

      thanks a lot