newbie question on datatable value binding
This just cannot be this difficult.
I'm a little new to JSF and am still learning the the ins and outs of using a datatable to hook into a database. Thus far I've connected to the DB, selected a range of values, and displayed them. Now I want to set something up where the user clicks on one of the returned values and sees details about it. This will involve passing that item's value back to the bean and hitting the database again to get additional details. The data is just returning the "name" and "id" fields from a table, and I want to go back and show all of the details for that "id". Do I need to do a bind on the datatable? Is it necessary to set up a datamodel? I'd be happy to get an RTFM response here if someone can just point me to the right info.
Here's the datatable:
<h:dataTable value="#{fieldview.all}" var="farm">
<h:column>
<f:facet name="header">
<f:verbatim>Farm ID</f:verbatim>
</f:facet>
<h:outputText value="#{farm.farmid}"/>
</h:column>
<h:column>
<f:facet name="header">
<f:verbatim>Farm Name</f:verbatim>
</f:facet>
<h:outputText value="#{farm.farmname}"/>
</h:column>
</h:dataTable>
And here's the method that is populating the table:
public Result getAll()throws SQLException, NamingException{
ResultSet result =null;
try{
open();
Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY);
result = stmt.executeQuery("SELECT username, farm.id as \"farmid\", name as \"farmname\" from farm");
return ResultSupport.toResult(result);
}finally{
close();
}
}
I'm afraid I'm a little stuck on where to go from here, any help would be much appreciated.
Thanks a lot,
Alex

