2 Replies Latest reply on Aug 21, 2007 11:56 AM by matt.drees

    Learning to use s:selectItems

    mikeeprice

      Using jboss-4.2.1.GA and jboss-seam-2.0.0.BETA1

      Given in peoplePopup.xhtml

      ...
      <h:selectOneMenu>
      <s:selectItems value="#{allPeople}" var="n" label="#{n.name}" />
      </h:selectOneMenu>
      ...

      in PersonManagerAction.java
      ...
      @DataModel
      private List allPeople;

      @DataModelSelection(value="allPeople")
      private Person selectedPerson;
      ...

      allPeople has an @Factory method and the list pops up fine showing the names from all the Person entities and lets me make the selection

      then the following is executed from a commandButton in peoplePopup.xhtml
      public void selectTest()
      {
      System.out.println("******* selectTest Name= "+selectedPerson.getName());
      }

      always prints out the first item in the selection list regardless of which one I selected.

      So I am thinking this is not the way to do this. I think it would be cool though.

      In other words select a name in the popup list and have the selected value be the associated Person entity object.