1 Reply Latest reply on Oct 22, 2010 4:47 PM by Chandra Sreeraman

    Factory values in a view

    Chandra Sreeraman Newbie
      Hello - Seam Newbie here.

      I have an application where I show a list of values that the user can select (using checkboxes). The values are static data from the database. I have also created a class that holds the values from the database as well as a boolean to indicate if it has been selected.

      I am using an application scoped factory to get the values from the database (since these values are frequently used) and am using these in a view.

      My question is :

      Is there a way to capture the values from the view to a backing bean and process the values - ie., on submit - i'd like to see which types were selected etc.

      Thanks in advance.

      Chandra Sreeraman

      Code Below:

      table - clienttype - values - {[id=1, type=MM], [id=2, type=BB]}

      ==== Model
      @Name ("clientTypesModel")
      public class ClientTypeModel {

              private Clienttype clientType;
              private Boolean selected;

      == Factory
      public class ClientTypeFactoryManager implements Serializable {

          private EntityManager entityManager;

          @Factory(value = "clientTypes")
          public void findContingencies() {
              List<Clienttype> clientTypesList = entityManager.createQuery("select clienttype from Clienttype clienttype ")

              if (this.clientTypes == null) {
                  this.clientTypes = new ArrayList<ClientTypeModel>();
              for (Clienttype ct : clientTypesList) {
                  ClientTypeModel ctm = new ClientTypeModel(ct, false);




                                      <f:facet name="header">
                                              <h:outputLabel value="Participant Type" />

                                                      <h:selectBooleanCheckbox value="#{participantType.selected}" />

                                                      <h:outputText value="#{participantType.clientType.name}" />