0 Replies Latest reply on Dec 1, 2012 10:27 AM by chinna raja

    No Such Element Exception.............in H:SelectManyListBox

    chinna raja Newbie

      Hi Jason Partor

       

      I am facing one issue .. here the error log ... i am getting one exception ,  i am using the  h:selectManyListbox  when i select some Values in the Search Box and click on search  i am getting this exception and its not oftenly comming ,its comes some times only could u please tel why its comming and code is pasted below please correct and correct me

       

       

      Caused by: java.util.NoSuchElementException

              at javax.faces.component.SelectItemsIterator.next(SelectItemsIterator.java:130)

              at javax.faces.component.SelectItemsIterator.next(SelectItemsIterator.java:157)

              at javax.faces.component.SelectItemsIterator.next(SelectItemsIterator.java:61)

              at javax.faces.component.SelectUtils.matchValue(SelectUtils.java:82)

              at javax.faces.component.UISelectMany.validateValue(UISelectMany.java:465)

              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 org.ajax4jsf.component.UIAjaxForm.processValidators(UIAjaxForm.java:82)

              at org.ajax4jsf.component.AjaxViewRoot$3.invokeContextCallback(AjaxViewRoot.java:447)

              at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:240)

              at org.ajax4jsf.component.AjaxViewRoot.processValidators(AjaxViewRoot.java:463)

              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)

       

       

       

      Code Looks Like  this:

      -------------------------------------------------

       

      Xhtml Code :

       

      <h:selectManyListbox style="width:200px;" size="5" id="executiveId"

       

       

                                                                                                          value="#{detailReportManager.selectedExecutivesList}"

        

                                                                                                          requiredMessage="Required" converter="javax.faces.Integer">

        

                                                                                                          <f:selectItems value="#{detailReportManager.executivesList}" />

        

                                                                                                          </h:selectManyListbox>

       

      For retrieving the Executive List Drop down

      ----------------------------------------------------------------------

       

       

      public List<SelectItem> retrieveExecutiveList(Integer conventionId){

                          if(this.detailReportSearchForm.getConvention() !=null){

                                    if(this.detailReportSearchForm.getConvention().getConventionId() !=null){

        

                                              Query query = entityManager.createQuery(" select distinct meeting.primarySalesPersonId  from Meeting meeting " +

                                                                  " where meeting.meetingId in (:meetingIdslist) order by meeting.primarySalesPersonId.firstName").setParameter("meetingIdslist", meetingIdsForConventionList);

                                              executivesList.clear();

                                              List<Executives> execList = new ArrayList<Executives>();

                                              execList.addAll(query.getResultList());

                                              for (Executives e : execList)

                                                        executivesList.add(new SelectItem(e.getId(), e.getFirstName() + " " + e.getLastName()));

                                              //executivesList.addAll(query.getResultList());

                                              return executivesList;

        

        

                                    }

                          }

                          return executivesList;

                }

       

      Retrieving the Data table

      ------------------------------------------

      public List<DetailReportSearchForm>retrieveListForMeetingList() throws ParseException{

      StringBuffer query = new StringBuffer(

                                              " select  DISTINCT meeting from Meeting meeting   ");

      if( this.selectedExecutivesList !=null && this.selectedExecutivesList.size() >0){

                                    query.append(" and meeting.primarySalesPersonId.id IN (:executiveList) ");

        

                          }

      Query q = this.entityManager.createQuery(query.toString());

      if(this.selectedExecutivesList.size() >0){

                                              q.setParameter("executiveList",this.selectedExecutivesList);

                                    }

       


      List<Meeting>meetingList=q.getResultList();

       

       

       

       

       

      }