I am new to
JSF. I am using <h:datatable> tag to retrieve data from database. Below is the method I have used but I am getting exception. Please help me in this regard.
I cannot understand what statement I am missing. I can see the values getting while debugging but cannot render back the request to the calling page.
Thanks in advance.
Exception is java.lang.ClassCastException: java.util.ArrayList
public List getPatient() {
List li = new ArrayList();
try {
con = ds.getConnection();
System.out.println("Connection Created");
} catch (SQLException s) {
s.printStackTrace();
}
try {
String query =
"SELECT last_name, first_name FROM h37patient_akas where patr_patient_id=" +
getPatientid();
ps = con.prepareStatement(query);
rs = ps.executeQuery();
while (rs.next()) {
li.add(new GetData(rs.getString("last_name"),
rs.getString("first_name")));
}
} catch (SQLException s) {
s.printStackTrace();
} finally {
try {
ps.close();
con.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
return li;
}
}