This week's book giveaway is in the Web Services forum.
We're giving away four copies of Microservices in Action and have Morgan Bruce & Paulo A. Pereira on-line!
See this thread for details.
Win a copy of Microservices in Action this week in the Web Services 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

while using SelectItems tag, I am getting IllegalArgumentException  RSS feed

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!