JSF Radio buttons + Datatable
843844Jul 17 2009 — edited Jan 5 2010Hi all,
I am new to JSF. I am working on an application wherin there is a page which contains a table populated using a <h:datatable> tag after the fields are fetched from the Oracle database. The code for which is as follows.
JSF code :
<h:panelGrid border="0" columns="5">
<h:dataTable value="#{adcreatebean.display}" var="display" >
<h:column>
<h:selectOneRadio onclick=" "
valueChangeListener="#{bean.setSelected}">
<f:selectItem itemValue="null" />
</h:selectOneRadio>
</h:column>
<h:column>
<h:outputText value="#{display.s1}"/>
</h:column>
<h:column>
<h:outputText value="#{display.s2}"/>
</h:column>
<h:column>
<h:outputText value="#{display.vs3}"/>
</h:column>
<h:column>
<h:outputText value="#{display.s4}"/>
</h:column>
</h:dataTable>
</h:panelGrid >
backing bean code:
public Result getDisplay() throws SQLException, NamingException {
ResultSet result = statement.executeQuery("select * from s_details");
return ResultSupport.toResult(result);
}
I tried to write the Code for radio button but was unable to succed in that. Can anyone please help with with the code or guide me to write a better one. I am working with oracle Database and this datatable in JSF contains a radio button tag on each row which is supposed to retrieve the corresponding row when selected.