[jboss-user] [JBoss Seam] - Re: UPDATED: SelectItems (the one with the EntityConverter)

fonseca do-not-reply at jboss.com
Mon Nov 13 10:05:48 EST 2006

Hello Peter,

I'm having a few troubles using your component, could you please help me out? I'm using the 1.1.1beta1 release, and my problem arises from using the following jsf structure (I'll filter out everything unimportant):

  | 	<t:dataTable var="var"
  |                 rowIndexVar="i"
  | 		value="#{ list }">
  | 		<h:column>
  | 			<h:commandLink action="#{ someBean.edit }" immediate="true" value="edit"/>
  | 		</h:column>
  | 		<h:column>
  | 			<h:outputText value="#{ var.somefield }" rendered="#{ index != i }"/>
  | 			<h:selectOneMenu value="#{ current.somefield }" rendered="#{ index == i }">
  | 				<si:selectItems value="#{ combo }" var="v" label="#{ v.somefield }"/>
  | 			</h:selectOneMenu>
  | 		</h:column>
  |           </t:dataTable>

I understand if this code appears a bit unusual, the point is to have both viewing and editing on the same table. The 'edit' method will, among a few other things, set the seam context variable 'index' to the position in the list of the selected item, as to have the second clause 'rendered' return true so to show the selectbox.

I've been working with such pattern, and it behaved nicely using f:selectItems and binding the values to strings. Upon switching to si:selectItems, however, I now get the following error as soon as entering the page:

  | javax.faces.el.PropertyNotFoundException: /WEB-INF/test.xhtml @50,118 value="#{ current.somefield }": Target Unreachable, identifier 'current' resolved to null
  | 	at com.sun.facelets.el.LegacyValueBinding.getType(LegacyValueBinding.java:96)
  | 	at org.jboss.seam.selectitems.jsf.SelectItemsComponentHandler.addConverters(SelectItemsComponentHandler.java:64)
  | 	at org.jboss.seam.selectitems.jsf.SelectItemsComponentHandler.onComponentCreated(SelectItemsComponentHandler.java:237)
  | 	at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:161)
  | 	at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:295)
  | 	at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:165)
  | 	at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
  | 	at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:295)
  | 	at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:165)
  | 	at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.j
  | ...

The outjected object 'current' is set only after the 'edit' method is invoked. So it makes sense that such error would occur if I was trying to show the combo upon first entering the page. Note, though, that the 'rendered' clause will return false in this occasion - i only want to see the combo after calling 'edit'. It seems si:selectItems attempts to evaluate the value of my h:selectOneMenu, whether or not it should be rendered, and it ends up breaking the code. Is there any way to achieve the behavior I want?

Much obliged,

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

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

More information about the jboss-user mailing list