java.sql.SQLException: Undeclared variable: 0 Query: SELECT * FROM stu LIMIT ? OFFSET ? Parameters: [5, 0]
public List<Student> findStudentByPage(int currentPage) throws SQLException {
System.out.println("数据库收到的="+currentPage);
QueryRunner runner = new QueryRunner(JDBCUtil.getDataSource());
// limt ? 返回多少条数据 offset ?跳过多少条数据
// 5 0 第一页(i-1)5
// 5 5 第二页
// 10 5
return runner.query("SELECT * FROM stu LIMIT ? OFFSET ? ",
new BeanListHandler<Student>(Student.class),PAGE_SIZE,(currentPage-1)*PAGE_SIZE);
public List<Student> findStudentByPage(int currentPage) throws SQLException {
System.out.println("数据库收到的="+currentPage);
QueryRunner runner = new QueryRunner(JDBCUtil.getDataSource());
// limt ? 返回多少条数据 offset ?跳过多少条数据
// 5 0 第一页(i-1)5
// 5 5 第二页
// 10 5
return runner.query("SELECT * FROM stu LIMIT ? OFFSET ? ",
new BeanListHandler<Student>(Student.class),PAGE_SIZE,(currentPage-1)*PAGE_SIZE);
SELECT * FROM stu LIMIT ? ,?
改成
SELECT * FROM stu LIMIT 20,10 ;