Problem with h:selectBooleanCheckbox inside h:dataTable

After submitting, boolean values are not getting set in our datatable, though other properties are set.

Earlier in the page, we have:

<h:selectBooleanCheckbox title="PhoneInd" value="#{CustomerProfileBean.faxPhonecallInd}" >

</h:selectBooleanCheckbox>

And this works fine.

However, in our dataTable, we have:

<h:dataTable id="ownershipTable" columnClasses="dynamicContent,dynamicContent,dynamicContent,dynamicContentCenter" headerClass="sectionSubHeader"

rowClasses="dynamicContent" styleClass="ownerShipTableWidth" value="#{CustomerProfileBean.iterationCounterArray}" var="iterationCounter">

<h:column>

<f:facet name="header">

<h:outputText value="Associated Parties"/>

</f:facet>

<h:outputText value="#{iterationCounter.customerProductAssociation.customer.firstNm}" />

<h:outputText value=" " />

<h:outputText value="#{iterationCounter.customerProductAssociation.customer.lastNm}" />

</h:column>

<h:column>

<f:facet name="header">

<h:outputText value="Role"/>

</f:facet>

<h:selectOneMenu value="#{iterationCounter.customerProductAssociation.customerProductRole}">

<f:selectItems value="#{CustomerProfileBean.dropDown.roles}"/>

</h:selectOneMenu>

</h:column>

<h:column>

<f:facet name="header">

<h:outputText value="End Date"/>

</f:facet>

<h:inputText id="expirationDate" size="10" value="#{iterationCounter.customerProductAssociation.expirationDt}">

<f:convertDateTime type="date" pattern="MM/d/yyyy"/>

</h:inputText>

<h:graphicImage id="imgId" alt="Address is valid " url="../CP2/unprotected/images/calendar.png"/>

</h:column>

<h:column>

<f:facet name="header">

<h:outputText value="Never Associated"/>

</f:facet>

<h:selectBooleanCheckbox title="isSelected" value="#{iterationCounter.selected}" />

</h:column>

</h:dataTable>

The problem is that iterationCounter.selected is always false. Inside our IterationCounter object, we put a debug breakpoint, and that never got hit. The getter method does get called however. Why does our checkbox not work in the dataTable? Also, all the other fields in our data table DO get set. Strange...

if anybody has solved the similar issue please let me know.

Thanks

Sanjay Kale

[3417 byte] By [sanjaykale2005a] at [2007-11-26 14:37:33]
# 1
I dont think the code you have posted is wrong. It seems fine to me because I also had to do the same thing and it worked.but are you sure about your backing bean? What do you keep inside your iterationCounterArray and what is the initial value of selected variable?
kalania at 2007-7-8 8:18:33 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

My IteratorCounter has

[CODE]

private CustomerProductAssociation customerProductAssociation = new CustomerProductAssociation();

public CustomerProductAssociation getCustomerProductAssociation()

{

return customerProductAssociation;

}

public void setCustomerProductAssociation(

CustomerProductAssociation customerProductAssociation)

{

this.customerProductAssociation = customerProductAssociation;

}

public boolean isSelected()

{

return selected;

}

public void setSelected(boolean isSelected)

{

this.selected = isSelected;

}[/code]

[CODE]

and a Bean has

[CODE]

private IterationCounter iterationCounterArray[] = new IterationCounter[0];

public IterationCounter[] getIterationCounterArray()

{

return iterationCounterArray;

}

public void setIterationCounterArray(

IterationCounter[] iterationCounterArray)

{

this.iterationCounterArray = iterationCounterArray;

}

[CODE]

sanjaykale2005a at 2007-7-8 8:18:33 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
still I cant see where you have defined and initialized the selected variable. if it's initial value is false, it is normal to have the check box unchecked. It's value is changed to true after you selecting the check box.
kalania at 2007-7-8 8:18:33 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
values doesn't get updated at all for all the inputText in the dataTable.
sanjaykale2005a at 2007-7-8 8:18:33 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...