1 Reply Latest reply on May 14, 2008 4:27 AM by Ilya Shaikovsky

    Problem UPDATTIG selectItems of h:selectOneMenu using a4j:su

    Madelyx Brianto Newbie

      Hi, I'm a new jsf and richfaces user and I have a problem with my application.

      I have a list of elements that I get from a bean, but then, the elements must chance depending of the user selection on a radiobutton that appears above the list.

      My jsp code:

      <h:selectOneRadio id="idioma" value="#{admincategoriasservicios.categoriaSerivcioActual.idioma}" >
      <f:selectItem id="es" itemLabel="#{msg.etiqueta_idioma_español}" itemValue="0" />
      <f:selectItem id="en" itemLabel="#{msg.etiqueta_idioma_ingles}" itemValue="1" />
      <a4j:support immediate="true" event="onclick" reRender="categoriaMenu" actionListener="#{admincategoriasservicios.listarCategorias}"/>
      </h:selectOneRadio>

      <h:selectOneMenu id="hola" value="#{admincategoriasservicios.categoriaSerivcioActual.id}" styleClass="contenido-parrafo">
      <f:selectItems id="categoriaMenu" value="#{admincategoriasservicios.listaCategorias}"/>
      </h:selectOneMenu>


      My bean admincategoriasservicios

      public class AdminCategoriasServicios {

      private ArrayList categorias = new ArrayList();
      private CategoriaServicio categoriaSerivcioActual = new CategoriaServicio();
      //set and get methos for each

      public void listarCategorias(ActionEvent evento){
      //sets the propertie this.categorias with data from DB depending of the checked radiobutton
      }


      public ArrayList getListaCategorias() {
      ArrayList listaCategorias = new ArrayList();
      for (int i = 0; i < this.categorias.size(); ++i) {
      System.out.println(this.categorias.get(i).getId()+" "+this.categorias.get(i).getNombre());
      listaCategorias.add(new SelectItem(new Integer(this.categorias.get(i).getId()),this.categorias.get(i).getNombre()));
      }
      return listaCategorias;
      }


      ----- The first time (when the page load) it works! and the list is fine.. but when i check any of the radiobuttons the follow error is given
      (CAN ANYBODY HELP ME PLEASE!!!!)
      PD: Sorry for my terrible english.. :(


      13-may-2008 17:16:59 com.sun.faces.lifecycle.Phase doPhase
      GRAVE: JSF1054: (Phase ID: PROCESS_VALIDATIONS 3, View ID: /protected/servicios/agregarServicio.jsp) Exception thrown during phase execution: javax.faces.event.PhaseEvent[source=com.sun.faces.lifecycle.LifecycleImpl@1860045]
      13-may-2008 17:16:59 org.apache.catalina.core.StandardWrapperValve invoke
      GRAVE: Servlet.service() para servlet Faces Servlet lanzó excepción
      java.util.NoSuchElementException
      at javax.faces.component.SelectItemsIterator.next(SelectItemsIterator.java:128)

      at javax.faces.component.SelectItemsIterator.next(SelectItemsIterator.java:155)
      at javax.faces.component.SelectItemsIterator.next(SelectItemsIterator.java:60)
      at javax.faces.component.UISelectOne.matchValue(UISelectOne.java:177)
      at javax.faces.component.UISelectOne.validateValue(UISelectOne.java:150)
      at javax.faces.component.UIInput.validate(UIInput.java:875)
      at javax.faces.component.UIInput.executeValidate(UIInput.java:1072)
      at javax.faces.component.UIInput.processValidators(UIInput.java:672)
      at javax.faces.component.UIForm.processValidators(UIForm.java:235)
      at org.ajax4jsf.component.AjaxViewRoot$3.invokeContextCallback(AjaxViewRoot.java:434)
      at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:234)
      at org.ajax4jsf.component.AjaxViewRoot.processValidators(AjaxViewRoot.java:450)
      at com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:76)
      at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
      at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:147)
      at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:256)
      at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:362)
      at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:488)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
      at java.lang.Thread.run(Unknown Source)