public List getDeptInfo(){
String sql = "select * from department";
PreparedStatement psmt=null;
List list = new ArrayList();
try {
psmt = conn.prepareStatement(sql);
ResultSet rs = psmt.executeQuery();
Department dept = null;
while(rs.next()){
dept.setDeptId(rs.getInt("DeptId"));
dept.setDeptName(rs.getString("DeptName"));
list.add(dept);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return list;
}