I have a scenario where I have to give an option to the user to select Applications and its related Profiles. The user should select at least one Application and One Profile and he can also select more than one. Each Application has its own Profiles and there can be multiple applications. My UserBean has a List of ApplicationVO and that ApplicationVO has selected (boolean), application id (int), application name(String) and Profile List. That Profile list has List of ProfileVO and ProfileVO has selected(boolean), profile id(int) and Profile name(String).
I am new to JSF and am using datatable and SelectBooleanCheckBox. When the user selects few Profile checkbox and submits, the UserBean Profile list is updated with wrong selected options. In other words, the checkboxes selected in the UI is different and the ProfileVO.isSelected() value doesnt match with the UI selection. Here is the code:
After submitting the page, I tried to iterate the applicationList in UserBean and found the UI selection didnt match. I am new to JSF so any help is appreciated. Thanks
EDIT: Added code tagsa
posted 7 years ago
I found that when the controls are rendered in the jsp page at runtime, JSF ordered the list by application id and profile id in my case. So instead of making JSF to order it, I sorted it and it all worked fine.