请问怎样加代码可以实现分页
public String cha() throws Exception {
Connection conn = DbConnection.getConnection();
Statement stmt = null;
try{
stmt = conn.createStatement();
String sql = "select * from text where id=1 ";
ResultSet rs = stmt.executeQuery(sql);
List list= new ArrayList();
while (rs.next()) {
User dt= new User();
dt.setId(rs.getInt("id"));
dt.setTime(rs.getString("time"));
list.add(dt);
}
HttpSession session = ServletActionContext.getRequest()
.getSession();
session.setAttribute("list", list);
conn.close();
rs.close();
stmt.close();
}catch (Exception e) {
e.printStackTrace();
}
return INPUT;
}
请问怎样加代码可以实现分页