I want to take record from database to my table in jsp page, but when run it, i have an error that say java.sql.SQLException: After end of result set, here is my code :
public String viewDataRegistrasi() throws SQLException{
String address="";
String query = "select*from pegawai";
System.out.println(query);
ResultSet rs = database.getInstance().executeSelectQuery(query);
ArrayList DataList = new ArrayList();
pegawai viewdata;
String idpeg = "";
while(rs.next()){
viewdata = new pegawai();
viewdata.setNik(rs.getString(1));
viewdata.setNama(rs.getString(2));
viewdata.setTempatlahir(rs.getString(3));
viewdata.setTanggallahir(rs.getString(4));
viewdata.setEmail(rs.getString(5));
viewdata.setAlamat(rs.getString(6));
viewdata.setPosisi(rs.getString(7));
DataList.add(viewdata);
}
request.setAttribute("viewRegistrasi", DataList);
idpeg = rs.getString(1) ;
address = "ViewPegawai.jsp";
return address;
}
can somebody help me please?? :'(