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!

How to use SelectOneRadio within a DataTable

843842Sep 13 2005 — edited Dec 14 2007
Hi,

I have a requirement to have a radio button for each row in the datatable. It is to enable selecting one row(only one row) from the table and proceed to the next page. The table should look like

o Name1 address1 city1 state1
o Name2 address2 city2 state2
o Name3 address3 city3 state3
o Name4 address4 city4 state4

Next>>

The data structure I have is a collection on objects of type person.
Class person
{
String id;
String name;
String address;
String city;
String state;

...
getters and setters
...
}

I tried to use SelectOneRadio within a Column, but that didnt help. As obvious it treats each rows radio button as a seperate radio group.

<h:datatable var="person" value="#{personList}>
<h:column>
<h:selectOneRadio>
<f:selectItem itemValue="#{person.id}"/>
</h:selectOneRadio>
</h:column>
<h:column>
<h:outputText value="#{person.name}"\>
</h:column>
.....

</h:datatable>

I am new to JSF. I searched thru some JSF websites and book, but couldnt find a solution. Can someone help me solve this.

Thanks in advance
Rani
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 11 2008
Added on Sep 13 2005
8 comments
1,335 views