Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

selectOneMenu does not find its child components.

 
Jakim Rachev
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
He everyone.

From some time now I'm stuck with this exception:
javax.servlet.ServletException: Expected a child component type of UISelectItem/UISelectItems for component type javax.faces.SelectOne(selectCar). Found null.
javax.faces.webapp.FacesServlet.service(FacesServlet.java:277)
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(selectCar). Found null.
com.sun.faces.renderkit.RenderKitUtils.getSelectItems(RenderKitUtils.java:320)
com.sun.faces.renderkit.html_basic.MenuRenderer.renderSelect(MenuRenderer.java:783)
com.sun.faces.renderkit.html_basic.MenuRenderer.encodeEnd(MenuRenderer.java:280)
javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:861)
javax.faces.component.UIComponent.encodeAll(UIComponent.java:937)
javax.faces.render.Renderer.encodeChildren(Renderer.java:148)
javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:837)
javax.faces.component.UIComponent.encodeAll(UIComponent.java:930)
javax.faces.component.UIComponent.encodeAll(UIComponent.java:933)
com.sun.faces.application.ViewHandlerImpl.doRenderView(ViewHandlerImpl.java:266)
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:197)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:110)
com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
org.jboss.
web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)


What I'm trying to do i is to populate a combobox with some items from a back been.
Here is my code.

BackBean



Cars.jsp



faces-config fragment



Please help me with this problem. I have also debuged it, and I notices that the get method returns null, but the bean do initialize on every request.
 
B Nirvan
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you need to declare managed-property in faces-config.xml. Just asking because I never did that. What's the point in declaring the same ?

regards,
Nirvan.
 
Ilari Moilanen
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I too think that the managed property might be your problem. First you set the values in your constructor (i.e. when the bean is created) but then you say that it should be null with "<value/>" so JSF sets it to null.

Maybe.
 
Jakim Rachev
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys. Tha was the problem.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic