• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

selectManyCheckBox doesnt popolate the values selected

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 41
Google Web Toolkit Tomcat Server Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Kumar sat
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 41
Google Web Toolkit Tomcat Server Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 41
Google Web Toolkit Tomcat Server Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
one question, why did you try to use a converter? Was it required in this case.
 
Kumar sat
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 41
Google Web Toolkit Tomcat Server Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check this link it will help you
http://www.exadel.com/web/portal/jsftags-guide
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic