[jboss-user] [JBoss jBPM] - Problem using SelectItems inside selectOneMenu

david_ling do-not-reply at jboss.com
Sun May 4 12:10:43 EDT 2008


Hi,

I am having some problems with using a <f:selectItems> element inside<h:selectOneMenu>.

To start off I created a Jbpm4Jsf tag/class that loads up a list of users, which I have tried to put into a Map and now a List.  I return this Map/List as the target inside the page and then place the target as the SelectItems value.

Please see code below


  | <ga:responseActions>
  |    <j4j:listAcademics target="#{academics}"/>
  | </ga:responseActions>
  | 
  |       <jbpm:datacell>
  |       	<f:facet name="header">
  |       		<h:outputText value="Supervisor"/>
  |       	</f:facet>
  |       	<h:selectOneMenu value="#{var['potentialsupervisor']}">
  |       		<f:selectItems value="#{academics}"/>
  |       	</h:selectOneMenu>
  | <!--      	<h:inputText value="#{var['potentialsupervisor']}"/>-->
  |       </jbpm:datacell>
  | 

However, when I submit my form, it throws a bunch of exceptions

  | javax.servlet.ServletException
  | 	javax.faces.webapp.FacesServlet.service(FacesServlet.java:256)
  | 	org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
  | 
  | 
  | root cause 
  | 
  | java.lang.IllegalArgumentException
  | 	javax.faces.component.SelectItemsIterator.next(SelectItemsIterator.java:166)
  | 	javax.faces.component.SelectItemsIterator.next(SelectItemsIterator.java:49)
  | 	javax.faces.component.UISelectOne.matchValue(UISelectOne.java:165)
  | 	javax.faces.component.UISelectOne.validateValue(UISelectOne.java:137)
  | 	javax.faces.component.UIInput.validate(UIInput.java:868)
  | 	javax.faces.component.UIInput.executeValidate(UIInput.java:1071)
  | 	javax.faces.component.UIInput.processValidators(UIInput.java:663)
  | 	javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1021)
  | 	javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1021)
  | 	javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1021)
  | 	javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1021)
  | 	javax.faces.component.UIForm.processValidators(UIForm.java:229)
  | 	javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1021)
  | 	javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1021)
  | 	javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1021)
  | 	javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:662)
  | 	com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:100)
  | 	com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:248)
  | 	com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
  | 	javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
  | 	org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
  | 
  | 

The tag/class I use to list all the academics is the following

  | public final class ListAcademicsActionListener implements JbpmActionListener {
  |     private final ValueExpression targetExpression;
  | 
  |     public ListAcademicsActionListener(final ValueExpression targetExpression) {
  |         this.targetExpression = targetExpression;
  |     }
  | 
  |     public String getName() {
  |         return "listAcademics";
  |     }
  | 
  |     @SuppressWarnings ({"unchecked"})
  |     public void handleAction(JbpmJsfContext context, ActionEvent event) {
  |         try {
  |             final FacesContext facesContext = FacesContext.getCurrentInstance();
  |             final ELContext elContext = facesContext.getELContext();
  |             final Collection<SelectItem> academicsList = new Vector<SelectItem>();
  | ... //queries DB some academics names and their userID
  | 
  |             while(academics.next()){
  |                SelectItem academic = new SelectItem(lecturerLogin, lecturer);
  |                academicsList.add(academic);
  |             }
  |             targetExpression.setValue(elContext, Collections.unmodifiableCollection(academicsList));
  |             context.selectOutcome("success");
  |          }
  | 

So far all the lecturer's names and logins come up fine, but the problem is when I submit the form.  I've searched around and there seems to be similar problems, but never quite the same.  Any help is appreciated.

Thanks

David

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4148550#4148550

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4148550



More information about the jboss-user mailing list