3 Replies Latest reply on Mar 31, 2008 8:29 AM by blabno

    DataTable selected object and its presence in context

    blabno Master

      I've noticed strange bahavior of dataTable selected object and its presence in context. I have two pageflows browseCountries and editCountry. The latter is subflow. When I am on countriesList.xhtml page (browseCountries pageflow), and click on a country from dataTable to edit it a new subflow is started - the editCountry pageflow. I want to display data of selected country there, but there is nothing in a context.
      However if I add following code to editCountry pageflow definition the selected country gets injected into bean's attribute and outjected into context, and thus available on editCountry.xhtml page.

         <transition to="editForm">
            <action expression="#{countryManager.init}"/>

      Could anybody explain why is this happening ? Why is selected country available only for bean and not directly on the page if bean is not touched ?

      I attach code of my beans, jPDL's and xhtml's for reference. They are of course trimmed to show only what is important.

      <pageflow-definition name="browseCountries">
          <start-page name="countriesList" view-id="/countriesList.xhtml">
              <transition name="edit" to="editCountry"/>
          <process-state name="editCountry">        
              <sub-process name="editCountry"/>     
              <transition to="countriesList"/>

      <pageflow-definition name="editCountry">
              <transition to="editForm">
                  <action expression="#{countryManager.init}"/>


      <h:dataTable value="#{countries}" var="country">
            <h:selectBooleanCheckbox value="#{countryBrowser.selectedCountries[country]}"/>
            <h:commandLink action="edit" value="#{country.name}"/>


         <h:outputText value="#{messages.countryName}"/>
         <h:inputText value="#{country.name}"/>


      public class ManageCountryActionBean implements ManageCountryAction {
          @In(value = "country", create = true)
          @Out(value = "country")
          private Country country;
           * Initiates bean attributes.
           * Method should be called from pageflow descriptor.
          public void init() {}