Select Row in DataTable: getRowData()
I am a beginner in JSF. Recently need to develop web appl with back-end db. but having problem in selecting row in data table. i read other posting and tried all method but still get error msg. please help.
my code indataTable back bean:
public String select()throws SQLException{
// 1st method try pulling data to UIData UItable by ResultSet
//ResultSet rs = (ResultSet)UItable.getRowData();
PhyBean physician =new PhyBean();
//physician.setLicno(rs.getString("LICNO"));
// 2nd method try pull data to HtmlDataTable table
//PhyBean physician = new PhyBean();
physician = (PhyBean)table.getRowData();
return"gotOne";
}
my code in jps:
<h:dataTable value="#{dataTable.all}" var="dataTable">
<h:column>
<h:commandLink value="view" action="#{dataTable.select}"/>
</h:column>
please help. Thx.
[1399 byte] By [
wingshana] at [2007-11-27 1:40:18]

# 2
thx BalusC but I read that article already. the way that i pull information is by coding like this:
ResultSet result = displayQuery.executeQuery();
return ResultSupport.toResult(result);
but i tried to use the getRowData() to put information into either the UIData or HtmlDataTable. but both ways give me errors. those method are found from that article and some replies in this forum. pls help. thx alot.
# 3
First,
<h:dataTable value="#{dataTable.all}" var="dataTable">
You're overwriting the managed bean name with the name of the iterated row object.
Give it another unique name, for example:<h:dataTable value="#{dataTable.all}" var="row">
# 4
Sorry BalusC, once I called the getRowData() function, it will give me the null pointer exception.
even if i try this:
if((PhyBean)table.getRowData()==null){
return "error";
}else{
return "gotOne";
}
it still give me that nullpointer exception. thx
# 8
Ok, one last question, because i was coding to put all records to the database by doing:
public Result getAll(){
:
:
return ResultSupport.toResult(result);
}
because in the article the data was firstly put into a list and then published to the web... will that make a difference if i did it by returning a "Result"?
Thanks.