You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Jan Bols <ja...@ivpv.ugent.be> on 2005/06/01 16:57:27 UTC

inside dataTable can't find selectManyCheckBox component

I have a form like the following:

<h:form id="myForm">		
	<x:selectManyCheckbox id="items2" layout="spread">
		<f:selectItems value="#{test.items2}"/>
	</x:selectManyCheckbox>

	<x:dataTable var="item" value="#{test.items}" id="myDataTable">
		<h:column id="myColumn">
			<x:checkbox for="items2" index="0"/>
		</h:column>
	</x:dataTable>
</h:form>

test.items2 is an ArrayList containing 3 SelectItem objects:

public class Test {
	private Collection items2; 	
	public Test() {
		items2 = new ArrayList(3);
		items2.add(new SelectItem("200", "Duke's Quarterly", ""));
		items2.add(new SelectItem("202", "Duke's Diet and Exercise Journal",  
""));
		items2.add(new SelectItem("201", "Innovator's Almanac", ""));
	}
	public Collection getItems2() {return items2;}
	public void setItems2(Collection items2) {this.items2 = items2;}
}

When I render this I get the following error:

StandardWrapperValve[Faces Servlet]: Servlet.service() for servlet Faces  
Servlet threw exception
java.lang.IllegalStateException: Could not find component 'items2'  
(calling findComponent on component 'myForm:myDataTable_0:_id7')
	at  
org.apache.myfaces.renderkit.html.ext.HtmlCheckboxRenderer.renderSingleCheckbox(HtmlCheckboxRenderer.java:99)

It looks like the <x:checkbox> can't find the reference to the  
selectManyCheckbox with id="items2" due to the fact thatit's inside the  
dataTable. Is there another way to render the <x:checkbox> components  
inside a dataTable?

Greetings
Jan