[jboss-user] [JBoss Seam] - Re: @SelectItems and @SelectItemsSelection annotations?

jarkko@jab.fi do-not-reply at jboss.com
Tue Sep 19 09:05:37 EDT 2006


Hi,
 I just had a few hours of nice debugging time with the @SelectItems stuff. 

This first one works ok:
anonymous wrote : 
  | <h:selectOneListbox value="#{selector.selectedRegion}">
  | 	<f:selectItems value="#{regions}"/>
  | </h:selectOneListbox>

but this doesn't

anonymous wrote : <h:selectOneListbox value="#{region}">
  | 	<f:selectItems value="#{selector.regions}"/>
  | </h:selectOneListbox>



"selector" is SFSB with get/setRegions, get/setSelectedRegion in local interface and

@SelectItems
  | 	public List getRegions() {
  | 	List<Region> regions = (List<Region>) em
  | 				.createQuery("from Region").getResultList();
  |          return regions;
  | }
  | 

Instead the second one gives the following exception:


  | 2006-09-19 15:14:57,367 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/tc3Web].[jsp]] Servlet.service() for servlet jsp threw exception
  | java.lang.IllegalArgumentException: Collection referenced by UISelectItems with binding '#{selector.regions}' and Component-Path : {Component-Path : [Class: javax.faces.component.UIViewRoot,ViewId: /kohteen_valinta.jsp][Class: javax.faces.component.html.HtmlForm,Id: _tc3Portlet_kohteen_valinta_WAR_TrueConcept__id0][Class: javax.faces.component.html.HtmlSelectOneListbox,Id: _tc3Portlet_kohteen_valinta_WAR_TrueConcept__id1][Class: javax.faces.component.UISelectItems,Id: _tc3Portlet_kohteen_valinta_WAR_TrueConcept__id2]} does not contain Objects of type SelectItem
  | 	at org.apache.myfaces.util.SelectItemsIterator.next(SelectItemsIterator.java:182)
  | 	at org.apache.myfaces.renderkit.RendererUtils.internalGetSelectItemList(RendererUtils.java:487)
  | 	at org.apache.myfaces.renderkit.RendererUtils.getSelectItemList(RendererUtils.java:461)
  | 	at org.apache.myfaces.renderkit.html.HtmlRendererUtils.internalRenderSelect(HtmlRendererUtils.java:272)
  | 	at org.apache.myfaces.renderkit.html.HtmlRendererUtils.renderListbox(HtmlRendererUtils.java:235)
  | 	at org.apache.myfaces.renderkit.html.HtmlListboxRendererBase.encodeEnd(HtmlListboxRendererBase.java:73)
  | 	at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:331)
  | 	at javax.faces.webapp.UIComponentTag.encodeEnd(UIComponentTag.java:349)
  | 	at javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:253)
  | 	at org.apache.jsp.kohteen_005fvalinta_jsp._jspx_meth_h_selectOneListbox_0(kohteen_005fvalinta_jsp.java:254)
  | 	at org.apache.jsp.kohteen_005fvalinta_jsp._jspx_meth_h_form_0(kohteen_005fvalinta_jsp.java:143)
  | 	at org.apache.jsp.kohteen_005fvalinta_jsp._jspx_meth_f_view_0(kohteen_005fvalinta_jsp.java:102)
  | 	at org.apache.jsp.kohteen_005fvalinta_jsp._jspService(kohteen_005fvalinta_jsp.java:64)
  | 	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
  | 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
  | 

So instead of the wrapped result the original List (of Regions) is passed to f:selectItems. 

Is this expected behaviour? 

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

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



More information about the jboss-user mailing list