• 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

h:selectOneRadio in dataTable

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am retrieving values from database dynamically,I am iterating the same through dataTable, I need radio button beside each value and on selecting that radio button it should go to a page displaying values.

Please can any one give an idea, how I should do this.
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually, using a radio button to trigger an action like that is bad GUI technique. Radio buttons are designed for select-one/deselect-another displays. A standard button would be more appropriate here. Aside from purely user considerations, however, a radio button cannot trigger an action at all, unlike a commandButton or commandLink. The only way to get it to do so is to attach an AJAX event to it.

If you take the results of your database query, construct a DataModel object (ListDataModel or ArrayDataModel, preferably), and use that DataModel to wrap the query results, then your action method can tell which row was clicked by invoking the model object's rowData or rowIndex methods.

To make the model work properly, you must define it in a backing bean whose scope is NOT request scope and you have to set the dataTable's value= attribute to reference a property that retrieves that DataModel object (it's read-only, so no need for a "set" method, only "get").

 
Greenhorn
Posts: 17
IntelliJ IDE Netbeans IDE Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Tim the precise explanation is very helpful.

Mucho Gracias.
 
ranjith moram
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Tim, it was very helpful.
 
reply
    Bookmark Topic Watch Topic
  • New Topic