aspose file tools*
The moose likes JSF and the fly likes selectManyCheckBox doesnt popolate the values selected Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "selectManyCheckBox doesnt popolate the values selected" Watch "selectManyCheckBox doesnt popolate the values selected" New topic
Author

selectManyCheckBox doesnt popolate the values selected

Kumar sat
Greenhorn

Joined: Aug 04, 2011
Posts: 4
Hi,

I am newbee to JSF, facing a issue with the selected values.

Here is the scenario.

I have List of objects which i am populating in the .XHTML file.

<h:selectManyCheckbox value="#{srchDev.osSelected}">
<f:converter converterId="utilConverter" />
<f:selectItems value="#{srchDev.osList}" />
</h:selectManyCheckbox>

In the backing bean i have

private List<OS> osList;
private List<OS> osSelected;


In the converter

i am wondering on how the get the values selected.
In getAsObject method,
value of the String just returns "on".

How do i get the actual selected string or value and convert to an object.

Any examples will be really helpful

Thanks
s
H Jetly
Ranch Hand

Joined: Aug 26, 2010
Posts: 41

Hi,
As far as I know

takes a list of type SelectItem



and
the value will have to map to a string





Try modelling the solution like this it will help.

You would not have to use the converter then.


Harsh Jetly
Kumar sat
Greenhorn

Joined: Aug 04, 2011
Posts: 4
Hi,

But if we select multiple check box how would this get into the single String value i.e. private String osSelected?

Thanks

s

H Jetly wrote:Hi,
As far as I know

takes a list of type SelectItem



and
the value will have to map to a string





Try modelling the solution like this it will help.

You would not have to use the converter then.
H Jetly
Ranch Hand

Joined: Aug 26, 2010
Posts: 41

Sorry about that,
select One List Box, ya you are going in the right direction the only thing is


will change to
H Jetly
Ranch Hand

Joined: Aug 26, 2010
Posts: 41

one question, why did you try to use a converter? Was it required in this case.
Kumar sat
Greenhorn

Joined: Aug 04, 2011
Posts: 4
Currently, this is what i am trying to do, but its not getting the selected values into the list.

The populated list for the check box returns the objects.

I am looking for some good examples but finding any?

-s


H Jetly wrote:Sorry about that,
select One List Box, ya you are going in the right direction the only thing is


will change to
H Jetly
Ranch Hand

Joined: Aug 26, 2010
Posts: 41

Check this link it will help you
http://www.exadel.com/web/portal/jsftags-guide
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: selectManyCheckBox doesnt popolate the values selected
 
Similar Threads
Applying style class to only one item in h:selectmanyCheckbox
Need help for h:selectManyCheckbox
selectManyCheckbox in dataTable returns only the last selected item rather the whole list.
ajax4jsf: how to get selected value(s) from component with f:selectItems
can't get values from h:selectManyCheckbox