CommandLink / -Button does not work within nested datatable
Hi,
my CommandLink / -Button does not work within nested datatable. There is a Nullpointer-Exception when I try to get the "accid".
But when I put the Delete-Link / -Button in the last row of the accessorycat-Table it does always work!
Jsp:
...
<h:dataTable value="#{accessories.accesoryCatRows}" var="row" id="accessorycat" rows="#{accessories.rowNumbers}" first="#{accessories.firstRow}">
<f:param id="ranking" value="#{row.ranking}" />
<f:param id="id" value="#{row.id}" />
<h:column>
<h:inputText value="#{row.description}"/>
</h:column>
<h:column>
<h:commandButton value="#{msg.button_add}" actionListener="#{accessories.addAccessoryCat}"/>
</h:column>
<h:column>
<h:dataTable id="accessory" var="accessrow" value="#{row.accessory}">
<f:param id="accranking" value="#{accessrow.ranking}" />
<f:param id="accid" value="#{accessrow.id}" />
<f:param id="acccatid" value="#{row.id}" />
<h:column>
<h:outputText value="Ranking: #{accessrow.ranking}" />
<h:inputText value="#{accessrow.title}"/>
</h:column>
<h:column>
<h:commandButton value="#{msg.button_del}" actionListener="#{accessories.deleteAccessory}" action=""/>
</h:column>
</h:dataTable>
</h:column>
</h:dataTable>
...
Backing-Bean:
...
publicvoid deleteAccessory(ActionEvent event){
try{
UIParameter component = (UIParameter) event.getComponent().findComponent("accid");
Integer id = Integer.parseInt(component.getValue().toString());
System.out.println("Id: "+id);
}catch (Exception e){
e.printStackTrace();
}
}
...
Thanks,
Chris

