File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes Create HtmlSelectOneRadio through backing bean    Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Create HtmlSelectOneRadio through backing bean    " Watch "Create HtmlSelectOneRadio through backing bean    " New topic

Create HtmlSelectOneRadio through backing bean

James Ellis
Ranch Hand

Joined: Oct 14, 2004
Posts: 205
I need to create a HtmlSelectOneRadio box and add it to a panelGrid. Can anyone give me some sample code for how to create a radio box and initialize it with some test data (any data will do) through a backing bean.

My problem is I can't seem to figure out what is supposed to be in the setValue of

And without a value nothing is being displayed on the page...
g madhava
Ranch Hand

Joined: Sep 14, 2001
Posts: 85
Try the below.
James Ellis
Ranch Hand

Joined: Oct 14, 2004
Posts: 205
Thanks so much, that worked with one small change. I guess MyFaces doesn't like SelectItems as Integers, so you have to create them as Strings. Below is the updated (working) code.

Sudeep Agrawal
Ranch Hand

Joined: May 31, 2006
Posts: 34
Alternatively :

Chris Tiearney

Joined: Sep 16, 2008
Posts: 5

I'm using the ICEfaces framework and also need to dynamically generate these elements. I tried to use your technique described here but ended up with an error and a blank where all the elements are supposed to be. Here is the method:

And the error I keep getting is:

This application tries to generate a form with ICEfaces elements and then display it in a ice:panelPopup element containing only one ice:panelGroup element with the property: which is a HtmlPanelGroup object from the ICEfaces library.

Any help would be appreciated because I am totally lost at the moment.

Be or don't be.
I agree. Here's the link:
subject: Create HtmlSelectOneRadio through backing bean
It's not a secret anymore!