Win a copy of Spring Boot in Practice this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

while using SelectItems tag, I am getting IllegalArgumentException

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Now I am trying with different approach...lets I will give you detail..

My Bean:
package org.jbpm.identity;

import javax.faces.model.SelectItem;
import java.util.*;

public class SelectItemsBean {

protected List<SelectItem> plList = null;

public SelectItemsBean(){

}

public void setOptions(List<SelectItem> options) {
this.plList = options;
System.out.println("SelectItemsBeanClass = "+options);
}

public List<SelectItem> getOptions() {
return plList;
}
}

My faces.config.xml
<managed-bean>
<managed-bean-name>selectItemsBean</managed-bean-name>
<managed-bean-class>org.jbpm.identity.SelectItemsBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>

My UIform..
form.leaveapplication.xhtml
<h:selectOneMenu value="#{var['pl']}">
<f:selectItems value="#{selectItemsBean.plList}" />
</h:selectOneMenu>

Now I am getting error:
javax.servlet.ServletException: Expected a child component type of UISelectItem/UISelectItems for component type javax.faces.SelectOne(j_id214). Found null.
javax.faces.webapp.FacesServlet.service(FacesServlet.java:256)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

root cause

java.lang.IllegalArgumentException: Expected a child component type of UISelectItem/UISelectItems for component type javax.faces.SelectOne(j_id214). Found null.
com.sun.faces.renderkit.RenderKitUtils.getSelectItems(RenderKitUtils.java:357)
com.sun.faces.renderkit.html_basic.MenuRenderer.getOptionNumber(MenuRenderer.java:644)
com.sun.faces.renderkit.html_basic.MenuRenderer.renderSelect(MenuRenderer.java:762)
com.sun.faces.renderkit.html_basic.MenuRenderer.encodeEnd(MenuRenderer.java:304)
javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:829)
org.jboss.gravel.common.renderer.RendererBase.doEncode(RendererBase.java:88)
org.jboss.gravel.common.renderer.RendererBase.doEncode(RendererBase.java:96)
org.jboss.gravel.common.renderer.RendererBase.doEncode(RendererBase.java:86)
org.jboss.gravel.common.renderer.RendererBase$ElementImpl.doEncode(RendererBase.java:337)
org.jbpm.jsf.taskformlayout.renderer.DataFormRenderer.encodeCells(DataFormRenderer.java:148)
org.jbpm.jsf.taskformlayout.renderer.DataFormRenderer.encodeChildren(DataFormRenderer.java:116)
javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:810)
javax.faces.component.UIComponent.encodeAll(UIComponent.java:884)
javax.faces.component.UIComponent.encodeAll(UIComponent.java:890)
javax.faces.component.UIComponent.encodeAll(UIComponent.java:890)
javax.faces.render.Renderer.encodeChildren(Renderer.java:137)
javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:810)
javax.faces.component.UIComponent.encodeAll(UIComponent.java:884)
javax.faces.render.Renderer.encodeChildren(Renderer.java:137)
javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:810)
javax.faces.component.UIComponent.encodeAll(UIComponent.java:884)
javax.faces.render.Renderer.encodeChildren(Renderer.java:137)
javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:810)
javax.faces.component.UIComponent.encodeAll(UIComponent.java:884)
javax.faces.component.UIComponent.encodeAll(UIComponent.java:890)
com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:571)
javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:178)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:248)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
please help me to resolve this problem, I will be highly grateful to you

Thanking you,
Mansingh Shitole
 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
two problems:

1.) your setter for select items is never actually getting called. You could probably fix the problem by calling that setter in your constructor.

2.) you are binding the value of f:selectItems to plList, but your getter is for options. You can either change the getter to getPlList, or you can change the value binding to selectItemsBean.options

Hope this helps
~Zack
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic