File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes Mixing dataTable with selectOneRadio Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Mixing dataTable with selectOneRadio" Watch "Mixing dataTable with selectOneRadio" New topic

Mixing dataTable with selectOneRadio

Hussein Baghdadi
clojure forum advocate

Joined: Nov 08, 2003
Posts: 3479

I use <h ataTable/> component to render a list of my domain objects.

The new requirement now is to include a radio button in front of each displayed recored and only the marked radio should be submitted to the server.
How to do this?
If the value attribute of dataTable is the domain objects list, then what is the value attribute of selectOneRadio?
steel zheng

Joined: Nov 30, 2007
Posts: 1
It seems not a good resolution. I only try to use Javascript to make a "mockup" radio group. Do someone have any advice about this issue?
Hussein Baghdadi
clojure forum advocate

Joined: Nov 08, 2003
Posts: 3479

Create a wrapper object for your domain object and add a boolean property to it.

Build a list of this object, and display it via dataTable and when submitting the form back to the server, iterate through this list and check for the selected property value.
Bruno Marti

Joined: Jul 30, 2004
Posts: 2
Have a look at under DataTools family
I'm using the <jdt:singleRowSelector selection="#{TestBean.selected}" />.
Works great.
I agree. Here's the link:
subject: Mixing dataTable with selectOneRadio
It's not a secret anymore!