Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Changing checkbox selection from bean in JSF

843844Aug 8 2007 — edited Aug 20 2007
Hi,
All I need to do is check/uncheck some checkboxes based on a condition when a "select" checkbox is checked/unchecked.
I created an ArrayList of beans and accessed them from the jsp page
using datatable. After displaying the jsp page, i will click on the "select"
checkbox. Here I have a valueChangeListener, which calls a method
from my backing bean. Here is my code which explains the problem
better:
jsp page:
<dataTable value="#{handler.arraylist} var="bean">
...
<h:selectBooleanCheckbox value="#{bean.isChecked}" 
                         valueChangeListener="#{handler.processValueChange}" 
                          immediate="true" onclick="submit()"/>
....
</dataTable>
handler.java:
processValueChange(ValueChangeEvent event) {
   bean = arraylist.get(index);  
   if (condition){
       bean.setIsChecked(true);
       arraylist.set(index, bean);
   } 
}
This code is not changing the value of the checkbox. But when I display
the value of "bean.isChecked", it is displaying "true". And the result is
not reflected in the jsp page.
Can anyone please help me with this?

Thanks in advance.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 17 2007
Added on Aug 8 2007
8 comments
1,096 views