• 大小: 3.05MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-08-10
  • 语言: Java
  • 标签: web  

资源简介

web版学生关系系统源文件,包含分页显示,查询所有,根据姓名查询,根据性别查询,添加,更新,删除等功能.简单的继承了java web所用的一些基础技术.

资源截图

代码片段和文件信息

package cn.aylog.dao;

import java.sql.SQLException;
import java.util.Date;
import java.util.List;

import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.ResultSetHandler;
import org.apache.commons.dbutils.handlers.BeanHandler;
import org.apache.commons.dbutils.handlers.BeanListHandler;

import com.sun.scenario.effect.impl.sw.java.JSWBlend_COLOR_BURNPeer;

import cn.aylog.domain.Student;
import cn.aylog.utils.JDBCUtils;

/**
 * dao 层
 * @author aylog
 *
 */
public class StudentManageDao {
//添加学生功能
public void addStudent(Student student) throws SQLException{
QueryRunner queryRunner = new QueryRunner(JDBCUtils.getDatasource());
queryRunner.update(“INSERT into stu values(null?????);“
student.getSname()
student.getGender()
student.getPhone()
student.getHobby()
student.getBirthday()
);
}

public List selectStudentList() throws SQLException {
QueryRunner qr = new QueryRunner(JDBCUtils.getDatasource());
return qr.query(“select * from stu;“ new BeanListHandler(Student.class));
}

public Student selectStudentBySid(String sid) throws SQLException {
QueryRunner qr = new QueryRunner(JDBCUtils.getDatasource());
return qr.query(“select * from stu where sid = ?“ new BeanHandler(Student.class) sid);
}

public void updateStudent(Student student) throws SQLException {
System.out.println(student.toString());
QueryRunner qr = new QueryRunner(JDBCUtils.getDatasource());
qr.update(“UPDATE stu set sname=?gender=?phone=?hobby=?birthday=? where sid = ?“ 
student.getSname()
student.getGender()
student.getPhone()
student.getHobby()
student.getBirthday()
student.getSid()
);
}

public void deleteStudent(String sid) throws SQLException {
QueryRunner qr = new QueryRunner(JDBCUtils.getDatasource());
qr.update(“delete from stu where sid = ?“ sid);
}

public List selectStudentBySname(String sname) throws SQLException {
QueryRunner qr = new QueryRunner(JDBCUtils.getDatasource());
return qr.query(“select * from stu where sname = ?“new BeanListHandler(Student.class) sname);
}

public List selectStudentByGender(String gender) throws SQLException {
QueryRunner qr = new QueryRunner(JDBCUtils.getDatasource());
return qr.query(“select * from stu where gender = ?“new BeanListHandler(Student.class) gender);
}
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2019-01-12 19:47  studentManage\
     文件         917  2019-01-06 23:19  studentManage\.classpath
     文件         913  2019-01-06 22:15  studentManage\.project
     目录           0  2019-01-12 19:47  studentManage\.settings\
     文件         567  2019-01-06 22:15  studentManage\.settings\.jsdtscope
     文件         364  2019-01-06 22:15  studentManage\.settings\org.eclipse.jdt.core.prefs
     文件         491  2019-01-06 22:15  studentManage\.settings\org.eclipse.wst.common.component
     文件         345  2019-01-06 22:15  studentManage\.settings\org.eclipse.wst.common.project.facet.core.xml
     文件          49  2019-01-06 22:15  studentManage\.settings\org.eclipse.wst.jsdt.ui.superType.container
     文件           6  2019-01-06 22:15  studentManage\.settings\org.eclipse.wst.jsdt.ui.superType.name
     文件         370  2019-01-11 17:17  studentManage\.tern-project
     目录           0  2019-01-12 19:47  studentManage\build\
     目录           0  2019-01-12 19:47  studentManage\build\classes\
     文件         921  2019-01-06 23:13  studentManage\build\classes\c3p0-config.xml
     目录           0  2019-01-12 19:47  studentManage\build\classes\cn\
     目录           0  2019-01-12 19:47  studentManage\build\classes\cn\aylog\
     目录           0  2019-01-12 19:47  studentManage\build\classes\cn\aylog\dao\
     文件        3285  2019-01-12 11:01  studentManage\build\classes\cn\aylog\dao\StudentManageDao.class
     目录           0  2019-01-12 19:47  studentManage\build\classes\cn\aylog\domain\
     文件        1436  2019-01-12 16:35  studentManage\build\classes\cn\aylog\domain\PageStudent.class
     文件        2016  2019-01-10 20:59  studentManage\build\classes\cn\aylog\domain\Student.class
     目录           0  2019-01-12 19:47  studentManage\build\classes\cn\aylog\service\
     文件        3013  2019-01-12 16:59  studentManage\build\classes\cn\aylog\service\StudentManageServices.class
     目录           0  2019-01-12 19:47  studentManage\build\classes\cn\aylog\utils\
     文件         940  2019-01-08 23:24  studentManage\build\classes\cn\aylog\utils\JDBCUtils.class
     文件        1128  2019-01-11 18:36  studentManage\build\classes\cn\aylog\utils\ParseMyDate.class
     目录           0  2019-01-12 19:47  studentManage\build\classes\cn\aylog\web\
     文件        2391  2019-01-12 19:35  studentManage\build\classes\cn\aylog\web\AddStudentServlet.class
     文件        1720  2019-01-12 19:36  studentManage\build\classes\cn\aylog\web\DeleteStudentServlet.class
     文件        1546  2019-01-12 19:37  studentManage\build\classes\cn\aylog\web\ListStudentServlet.class
     文件        2060  2019-01-12 19:38  studentManage\build\classes\cn\aylog\web\PageshowStudentServlet.class
............此处省略55个文件信息

评论

共有 条评论