首页>代码>java Servlet+mysql开发学生信息增删改查和分页查询功能,适合java web开发初学者>/fenye2/page/src/cn/pdsu/DataSourceDAO.java
package cn.pdsu; import java.util.LinkedList; import java.util.List; import cn.pdsu.Student; import java.sql.DriverManager; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.List; import cn.pdsu.Student; /** * 类说明:数据的封装 * * @author 作者: LiuJunGuang * @version 创建时间:2011-11-9 下午02:28:27 */ public class DataSourceDAO { private List<Student> list = new LinkedList<Student>();// private Connection con; //for (int i = 0; i < 20; i++) { //list.add(new Student(i, "王二" + i, "男", "学生" + i)); //} /** * 模拟数据库中分页查询 * * @param startIndex * 要查询的开始索引 * @param count * 查询的总记录数 * @return 查询出的学生记录 */ public List<Student> findStudent(int startIndex, int count) { Student student=new Student(); list = student.getAllStudents(); int num = count + startIndex; if (num > list.size()) num = list.size(); return list.subList(startIndex, num); } /** * 模拟数据库中查询总记录数 * * @return 总的记录数 */ public int count() { Student student=new Student(); list=student.getAllStudents(); return list.size(); } }

taoshen95 LV16
2024年12月16日
asddwh LV13
2023年12月29日
wuge123 LV8
2023年6月12日
1719863922 LV11
2022年6月17日
刚刚vv谭v LV4
2022年1月4日
微信网友_5768552477921280 LV6
2022年1月2日
17771013609 LV4
2021年12月31日
fesdfs LV1
2021年12月20日
3089559272 LV11
2021年12月17日
龙门客栈 LV9
2021年12月16日

taoshen95 LV16
2024年12月16日
时光海 LV2
2024年7月1日
liyan54188 LV2
2024年6月25日
sdaijdiafafon
2024年6月23日
暂无贡献等级
沈从文 LV3
2023年12月31日
asddwh LV13
2023年12月25日
wodewode LV1
2023年12月23日
微信网友_6786215447367680 LV5
2023年12月23日
好哇好哇还是
2023年12月20日
暂无贡献等级
颜菜菜 LV2
2023年12月19日