7 Replies Latest reply on Aug 29, 2007 10:31 AM by yohann Normandin

    SelectOneRadio

    yohann Normandin Newbie

      hello !

      I have a page with radio buttons. But when I click on the submit button, I don't know what button has been selected.

      My bean :

      @Stateful
      @Scope(SESSION)
      @Name("PackageManager")
      public class PackageManager implements com.pingwy.web.front.PackageManagerLocal, Serializable {
      
       /**
       * Creates a new instance of PackageManager
       */
      
       @In
       private EntityManager em;
      
       @In(required = false) @Out(required = false) private List<Package> packages = new ArrayList<Package>();
      
       //@In(required = false) @Out(required = false) private List<Package> packageLine = new ArrayList<Package>();
      
       @In(required = false) @Out(required = false) private Package packageLine;
      
       @Factory(value ="packages")
       public void findPackage(){
      
       System.out.println("bonjour");
      
       Query query;
      
       query = em.createQuery("Select p From Package p");
       packages = (List<Package>) query.getResultList();
      
      
       }
      
       @Remove @Destroy
       public void destroy(){
       }
      
       public Package getPackageLine() {
       return packageLine;
       }
      
       public void setPackageLine(Package packageLine) {
       this.packageLine = packageLine;
       }
      
       public List<Package> getPackages() {
       return packages;
       }
      
       public void setPackages(List<Package> packages) {
       this.packages = packages;
       }
      
      }
      


      My jsf page :
      <html xmlns="http://www.w3.org/1999/xhtml"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:s="http://jboss.com/products/seam/taglib"
       xmlns:rich="http://richfaces.ajax4jsf.org/rich">
      
      
      
       <ui:composition template="templates/client.xhtml">
      
       <ui:define name="servicesclients">
      
       <h:form>
      
      
       <h:selectOneRadio value="#{PackageManager.packageLine}" layout="pageDirection" >
       <s:selectItems value="#{packages}" var="pack" label="#{pack.packName} : #{pack.descriptionPa.ck}"/>
       </h:selectOneRadio>
      
       <h:commandButton value="Next" type="submit"/>
      
       </h:form>
      
       </ui:define>
      
      
      
       </ui:composition>
      
      


      thanks in advance.
      Yohann