学生信息管理系统/辅导员信息管理系统

题目:学生信息管理系统、辅导员信息管理系统(完整版)

1、前言(小白耐心看、大神跳过

在大学系统的学习完了JAVA基础、WEB、HTML5、J2EE、MYSQL数据库、JSP后。完成课程设计:学生信息管理系统/辅导员信息管理系统。要求:开发一款辅导员管理学生信息的系统,实现高校辅导员对学生信息进行管理。普通用户功能:登录、查看自己相关的信息。管理员功能:普通用户管理、添加、删除、修改、查询学生信息。学生用户登录成功主要功能是可以查看个人信息和个人信息修改。辅导员用户登录成功主要功能是进行班级管理和学生信息管理。结合知识之间的应用联系完成了学生信息管理系统的编程。是入门级别的编程了,没有太多的技术要求。基本处理一些数据与用户之间的逻辑关系编写完成。没有涉及到高层的框架,简单的MVC框架完成的,手把手教学一些想入门的小白啦!

2、项目效果

1、主界面(支持辅导员用户、学生用户注册登录操作)

2、注册(注册辅导员用户与学生用户注册。具有校验功能)
学生信息管理系统/辅导员信息管理系统_第1张图片
3、辅导员主页(个人信息管理、按班级分类进行管理、可以对班级进行增删改查操作)
学生信息管理系统/辅导员信息管理系统_第2张图片
4、班级学生成员信息(可以条件查询、精确查询及模糊查询、修改、添加、删除)
学生信息管理系统/辅导员信息管理系统_第3张图片
5、添加学生(辅导员在管理的班级中添加学生信息,给学生一个默认的登录密码abc123)
学生信息管理系统/辅导员信息管理系统_第4张图片

6、辅导员查看管理的全体学生页面
学生信息管理系统/辅导员信息管理系统_第5张图片
7、学生用户主界面(个人信息查看、修改)
学生信息管理系统/辅导员信息管理系统_第6张图片
8、个人信息修改
学生信息管理系统/辅导员信息管理系统_第7张图片
9、数据库设计(设计报告有详情)
学生信息管理系统/辅导员信息管理系统_第8张图片
10、项目目录
学生信息管理系统/辅导员信息管理系统_第9张图片
11、注意(修改数据库密码)
学生信息管理系统/辅导员信息管理系统_第10张图片

3、源代码下载地址:https://download.csdn.net/download/qq_40529129/12741094

源代码下载地址:https://download.csdn.net/download/qq_40529129/12741094
1、dao
StuDao

package com.lmj.dao;

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

import com.lmj.daobean.StuInfo;
import com.lmj.daobean.StuUser;

public interface StuDao {
     
	
	public int stregistered(StuUser stuUser ) throws SQLException;
	public void addstuinfo(StuInfo stuInfo ) throws SQLException;
	public List<StuUser> repeat() throws SQLException;
	public StuUser studentLogin(String stid) throws SQLException;
	public  StuInfo queryStuInfo(String id)throws SQLException;
	public void updateStu(StuInfo StuInfo) throws SQLException;
	public List<StuInfo> queryListStuInfo(String stclass) throws SQLException;
	public List<StuInfo> searchStudent(String id,String name,String idclass,String gender,String identity) throws SQLException;
	public void deleteStuInfo(String id) throws SQLException;
	public void deleteStuUser(String id) throws SQLException;
	public boolean modifyStuPass(String id,String password)throws SQLException;

}

CounDao

package com.lmj.dao;

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

import com.lmj.daobean.CounClass;
import com.lmj.daobean.CounInfo;
import com.lmj.daobean.CounUser;

public interface CounDao {
     
	public int counregistered(CounUser counUser ) throws SQLException;
	public List<CounUser> repeat() throws SQLException;
	public CounUser  counselorLogin(String coid) throws SQLException;
	public void addcouinfo(CounInfo counInfo ) throws SQLException;
	public void addCoClass(CounClass ounClass ) throws SQLException;
	public CounInfo queryCounInfo(String id) throws SQLException;
	public List<CounClass> queryCounClass(String id) throws SQLException;
	public CounClass queryCounId(String stclass) throws SQLException;
	public void counAddClass(String coid,String name,String coclass)throws SQLException;
	public void deleteCounClass(String coclass) throws SQLException;
	public void updeatCounInfo(String name,String phone,String email,String office,String id) throws SQLException;
	public List<CounClass> queryClass() throws SQLException;
	public boolean modifyCounPass(String id,String password)throws SQLException;
}

SCclassDao

package com.lmj.dao;
import java.sql.SQLException;
import java.util.List;

import com.lmj.daobean.SCclass;
public interface SCclassDao {
     
	public void addclass(SCclass cclass )throws SQLException;
	public List<SCclass> queryClass()throws SQLException;
	public void addNewClss(String stclass,String idclass,String coclass)throws SQLException;
	public SCclass queryRepeat(String idclass)throws SQLException;
}

2、bean
StuInfo

package com.lmj.daobean;

		public class StuInfo {
     	
			
		private String id;
		private String name;
		private String gender;
		private String stclass;
		private String phone;
		private String address;
		private String email;
		private String birthday;
		private String identity;
		private String dormitory;
		
		public StuInfo(String name ,String gender, String stclass, String phone, String address, String email,
				String birthday, String identity, String dormitory) {
     
			super();
			this.name = name;
			this.gender = gender;
			this.stclass = stclass;
			this.phone = phone;
			this.address = address;
			this.email = email;
			this.birthday = birthday;
			this.identity = identity;
			this.dormitory = dormitory;
		}
		
		public StuInfo(String id, String name, String gender, String stclass, String phone, String address, String email,
				String birthday, String identity, String dormitory) {
     
			super();
			this.id = id;
			this.name = name;
			this.gender = gender;
			this.stclass = stclass;
			this.phone = phone;
			this.address = address;
			this.email = email;
			this.birthday = birthday;
			this.identity = identity;
			this.dormitory = dormitory;
		}
		
		
		public StuInfo(String id, String name) {
     
			super();
			this.id = id;
			this.name = name;
		}
		
		
		public String getId() {
     
			return id;
		}
		public void setId(String id) {
     
			this.id = id;
		}
		public String getName() {
     
			return name;
		}
		public void setName(String name) {
     
			this.name = name;
		}
		public String getGender() {
     
			return gender;
		}
		public void setGender(String gender) {
     
			this.gender = gender;
		}
		public String getStclass() {
     
			return stclass;
		}
		public void setStclass(String stclass) {
     
			this.stclass = stclass;
		}
		public String getPhone() {
     
			return phone;
		}
		public void setPhone(String phone) {
     
			this.phone = phone;
		}
		public String getAddress() {
     
			return address;
		}
		public void setAddress(String address) {
     
			this.address = address;
		}
		public String getEmail() {
     
			return email;
		}
		public void setEmail(String email) {
     
			this.email = email;
		}
		public String getBirthday() {
     
			return birthday;
		}
		public void setBirthday(String birthday) {
     
			this.birthday = birthday;
		}
		public String getIdentity() {
     
			return identity;
		}
		public void setIdentity(String identity) {
     
			this.identity = identity;
		}
		public String getDormitory() {
     
			return dormitory;
		}
		public void setDormitory(String dormitory) {
     
			this.dormitory = dormitory;
		}
		public StuInfo() {
     
			super();
			// TODO Auto-generated constructor stub
		}
		@Override
		public String toString() {
     
			return "StuInfo [id=" + id + ", name=" + name + ", gender=" + gender + ", stclass=" + stclass + ", phone=" + phone
					+ ", address=" + address + ", email=" + email + ", birthday=" + birthday + ", identity=" + identity
					+ ", dormitory=" + dormitory + "]";
		}
		
		
		
}

CounInfo

package com.lmj.daobean;

public class CounInfo {
     
	private String id;
	private String name;
	private String phone;
	private String email;
	private String office;
	
	public CounInfo(String id, String name) {
     
		super();
		this.id = id;
		this.name = name;
	}

	public CounInfo(String id, String name, String phone, String email, String office) {
     
		super();
		this.id = id;
		this.name = name;
		this.phone = phone;
		this.email = email;
		this.office = office;
	}

	public String getId() {
     
		return id;
	}

	public void setId(String id) {
     
		this.id = id;
	}

	public String getName() {
     
		return name;
	}

	public void setName(String name) {
     
		this.name = name;
	}

	public String getPhone() {
     
		return phone;
	}

	public void setPhone(String phone) {
     
		this.phone = phone;
	}

	public String getEmail() {
     
		return email;
	}

	public void setEmail(String email) {
     
		this.email = email;
	}

	public String getOffice() {
     
		return office;
	}

	public void setOffice(String office) {
     
		this.office = office;
	}

	public CounInfo() {
     
		super();
		// TODO Auto-generated constructor stub
	}

	@Override
	public String toString() {
     
		return "CounInfo [id=" + id + ", name=" + name + ", phone=" + phone + ", email=" + email + ", office=" + office
				+ "]";
	}
	
	
	
}

CounClass

package com.lmj.daobean;

public class CounClass {
     
	private String coid;
	private String name;
	private String coclass;
	public CounClass(String coid, String name) {
     
		super();
		this.coid = coid;
		this.name = name;
	}
	public CounClass(String coid, String name, String coclass) {
     
		super();
		this.coid = coid;
		this.name = name;
		this.coclass = coclass;
	}
	public String getCoid() {
     
		return coid;
	}
	public void setCoid(String coid) {
     
		this.coid = coid;
	}
	public String getName() {
     
		return name;
	}
	public void setName(String name) {
     
		this.name = name;
	}
	public String getCoclass() {
     
		return coclass;
	}
	public void setCoclass(String coclass) {
     
		this.coclass = coclass;
	}
	@Override
	public String toString() {
     
		return "CounClass [coid=" + coid + ", name=" + name + ", coclass=" + coclass + "]";
	}
	public CounClass() {
     
		super();
		// TODO Auto-generated constructor stub
	}
	
	
	
}

CounUser

package com.lmj.daobean;

public class CounUser {
     
	private String coid;
	private String coname;
	private String copassword;
	public CounUser(String coid, String coname, String copassword) {
     
		super();
		this.coid = coid;
		this.coname = coname;
		this.copassword = copassword;
	}
	public String getCoid() {
     
		return coid;
	}
	public void setCoid(String coid) {
     
		this.coid = coid;
	}
	public String getConame() {
     
		return coname;
	}
	public void setConame(String coname) {
     
		this.coname = coname;
	}
	public String getCopassword() {
     
		return copassword;
	}
	public void setCopassword(String copassword) {
     
		this.copassword = copassword;
	}
	public CounUser() {
     
		super();
		// TODO Auto-generated constructor stub
	}
	@Override
	public String toString() {
     
		return "CounUser [coid=" + coid + ", coname=" + coname + ", copassword=" + copassword + "]";
	}
	
	
}

StuUser

package com.lmj.daobean;

public class StuUser {
     
	private String stid;
	private String stpassword;
	private String stname;
	public StuUser(String stid, String stpassword, String stname) {
     
		super();
		this.stid = stid;
		this.stpassword = stpassword;
		this.stname = stname;
	}
	public String getStid() {
     
		return stid;
	}
	public void setStid(String stid) {
     
		this.stid = stid;
	}
	public String getStpassword() {
     
		return stpassword;
	}
	public void setStpassword(String stpassword) {
     
		this.stpassword = stpassword;
	}
	public String getStname() {
     
		return stname;
	}
	public void setStname(String stname) {
     
		this.stname = stname;
	}
	public StuUser() {
     
		super();
		// TODO Auto-generated constructor stub
	}
	@Override
	public String toString() {
     
		return "StuUser [stid=" + stid + ", stpassword=" + stpassword + ", stname=" + stname + "]";
	}
	
	
}

3、daoimpl
CounDaoImpl

package com.lmj.dao.daoimpl;

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

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

import com.lmj.dao.CounDao;
import com.lmj.daobean.CounClass;
import com.lmj.daobean.CounInfo;
import com.lmj.daobean.CounUser;
import com.lmj.util.JdbcUtil;

public class CounDaoImpl implements CounDao {
     

	//辅导员注册
	@Override
	public int counregistered(CounUser counUser) throws SQLException {
     
		// TODO Auto-generated method stub
		QueryRunner runner = new QueryRunner(JdbcUtil.getDataSource());
		int i = runner.update("insert into counselor_user values(?,?,?)",
				counUser.getCoid(),
				counUser.getCopassword(),
				counUser.getConame()
				);
		return i;
	}

	//查询所有信息是否重复
	@Override
	public List<CounUser> repeat() throws SQLException {
     
		// TODO Auto-generated method stub
		QueryRunner runner = new QueryRunner(JdbcUtil.getDataSource());
		List<CounUser> list = runner.query("select * from counselor_user", new BeanListHandler<CounUser>(CounUser.class));
		return list;
	}

	//辅导员登录
	@Override
	public CounUser counselorLogin(String coid) throws SQLException {
     
		// TODO Auto-generated method stub
		QueryRunner runner = new QueryRunner(JdbcUtil.getDataSource());
		CounUser user = runner.query("select * from counselor_user where coid = ?",new BeanHandler<CounUser>(CounUser.class),coid);
	    return user;
	}
	
	//添加到辅导员信息表
	@Override
	public void addcouinfo(CounInfo counInfo) throws SQLException {
     
		// TODO Auto-generated method stub
		QueryRunner runner = new QueryRunner(JdbcUtil.getDataSource());
		 runner.update("insert into counselor_info values(?,?,?,?,?)",
				 counInfo.getId(),
				 counInfo.getName(),
				 counInfo.getPhone(),
				 counInfo.getEmail(),
				 counInfo.getOffice()
				);
	}

	//添加辅导员信息到辅导员班级表
	@Override
	public void addCoClass(CounClass ounClass) throws SQLException {
     
		// TODO Auto-generated method stub
		QueryRunner runner = new QueryRunner(JdbcUtil.getDataSource());
		 runner.update("insert into counselor_class values(?,?,?)",
				 ounClass.getCoid(),
				 ounClass.getName(),
				 ounClass.getCoclass()
				 );
	}

	//查询辅导员信息
	@Override
	public CounInfo queryCounInfo(String id) throws SQLException {
     
		// TODO Auto-generated method stub
		QueryRunner runner = new QueryRunner(JdbcUtil.getDataSource());
		CounInfo counInfo = runner.query("select * from counselor_info where id = ?",new BeanHandler<CounInfo>(CounInfo.class),id);
		return counInfo;
	}

	//查询辅导员与班级表
	@Override
	public List<CounClass> queryCounClass(String id) throws SQLException {
     
		// TODO Auto-generated method stub
		QueryRunner runner = new QueryRunner(JdbcUtil.getDataSource());
		List<CounClass> list = runner.query("select * from counselor_class where coid = ?", new BeanListHandler<CounClass>(CounClass.class),id);
		return list;
	}

	//通过班级查辅导员
	@Override
	public CounClass queryCounId(String stclass) throws SQLException {
     
		// TODO Auto-generated method stub
		QueryRunner runner = new QueryRunner(JdbcUtil.getDataSource());
		CounClass counClass = runner.query("select * from counselor_class where coclass = ?", new BeanHandler<CounClass>(CounClass.class),stclass);
		return counClass;
	}

	
	//辅导员添加班级
	@Override
	public void counAddClass(String coid,String name,String coclass) throws SQLException {
     
		// TODO Auto-generated method stub
		
		QueryRunner runner = new QueryRunner(JdbcUtil.getDataSource());
		 runner.update("insert into counselor_class values(?,?,?)",
				coid,
				name,
				coclass
				);
	}

	@Override
	public void deleteCounClass(String coclass) throws SQLException {
     
		// TODO Auto-generated method stub
		QueryRunner runner = new QueryRunner(JdbcUtil.getDataSource());
		runner.update("delete from counselor_class where coclass=?" ,coclass);
		
	}

	@Override
	public void updeatCounInfo(String name,String phone,String email,String office,String id) throws SQLException {
     
		// TODO Auto-generated method stub
		QueryRunner runner = new QueryRunner(JdbcUtil.getDataSource());
		runner.update("update counselor_info set  name=?, phone=? , email=? , office=? where id = ?",
				name,
				phone,
				email,
				office,
				id
				);
		
	}

	//查询辅导员与班级全表
	@Override
	public List<CounClass> queryClass() throws SQLException {
     
		// TODO Auto-generated method stub
		QueryRunner runner = new QueryRunner(JdbcUtil.getDataSource());
		List<CounClass> list = runner.query("select * from counselor_class", new BeanListHandler<CounClass>(CounClass.class));
		return list;
	}

	//修改辅导员密码
	@Override
	public boolean modifyCounPass(String id,String password) throws SQLException {
     
		// TODO Auto-generated method stub
		QueryRunner runner = new QueryRunner(JdbcUtil.getDataSource());
		int update = runner.update("update counselor_user set copassword = ? where coid = ?",password,id);
		return update>0;
	}

}

StuDaoImpl

package com.lmj.dao.daoimpl;

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

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

import com.lmj.dao.StuDao;
import com.lmj.daobean.StuInfo;
import com.lmj.daobean.StuUser;
import com.lmj.util.JdbcUtil;
import com.lmj.util.TextUtils;

public class StuDaoImpl implements StuDao {
     
	
	//判断账号重复
	@Override
	public List<StuUser> repeat() throws SQLException {
     
		// TODO Auto-generated method stub
		QueryRunner runner = new QueryRunner(JdbcUtil.getDataSource());
		List<StuUser> list = runner.query("select * from student_user", new BeanListHandler<StuUser>(StuUser.class));
		
		return list;
	}
	
	
	

	//学生注册
	@Override
	public int stregistered (StuUser stuUser) throws SQLException {
     
		QueryRunner runner = new QueryRunner(JdbcUtil.getDataSource());
		int i = runner.update("insert into student_user values(?,?,?)",
				stuUser.getStid(),
				stuUser.getStpassword(),
				stuUser.getStname()
				);
		return i;
	}
	
	
	//学生登录 通过用户名查密码返回
	public StuUser studentLogin(String stid) throws SQLException {
     
		QueryRunner runner = new QueryRunner(JdbcUtil.getDataSource());
	    StuUser user = runner.query("select * from student_user where stid = ?",new BeanHandler<StuUser>(StuUser.class),stid);
	    return user;
	}



	//学生登录后查看查询到的自己的信息
	@Override
	public StuInfo queryStuInfo(String id) throws SQLException {
     
		// TODO Auto-generated method stub
		QueryRunner runner = new QueryRunner(JdbcUtil.getDataSource());
		StuInfo stuInfo = runner.query("select * from student_info where id = ?",new BeanHandler<StuInfo>(StuInfo.class),id);
	    return stuInfo;
	}



	//存到学生信息表
	@Override
	public void addstuinfo(StuInfo StuInfo) throws SQLException {
     
		// TODO Auto-generated method stub
		QueryRunner runner = new QueryRunner(JdbcUtil.getDataSource());
		 runner.update("insert into student_info values(?,?,?,?,?,?,?,?,?,?)",
				StuInfo.getId(),
				StuInfo.getName(),
				StuInfo.getGender(),
				StuInfo.getStclass(),
				StuInfo.getPhone(),
				StuInfo.getAddress(),
				StuInfo.getEmail(),
				StuInfo.getBirthday(),
				StuInfo.getIdentity(),
				StuInfo.getDormitory()
				);
	}
	
	
	//修改
	@Override
	public void updateStu(StuInfo StuInfo) throws SQLException {
     
		
		QueryRunner runner = new QueryRunner(JdbcUtil.getDataSource());
		runner.update("update student_info set  name=?, gender=? , stclass=? , phone=? , address=? , email=?, birthday=?, identity=?, dormitory=? where id = ?", 
			StuInfo.getName(),
			StuInfo.getGender(),
			StuInfo.getStclass(),
			StuInfo.getPhone(),
			StuInfo.getAddress(),
			StuInfo.getEmail(),
			StuInfo.getBirthday(),
			StuInfo.getIdentity(),
			StuInfo.getDormitory(),
			StuInfo.getId()
						);
	}



/*	//更新学生班级
	@Override
	public void addClass(String idclass,String id) throws SQLException {
		// TODO Auto-generated method stub
		QueryRunner runner = new QueryRunner(JdbcUtil.getDataSource());
		runner.update("update student_info  set stclass=? where id=?",
				idclass,
				id
				);
	}*/



	//根据班级查询学生集合
	@Override
	public List<StuInfo> queryListStuInfo(String stclass) throws SQLException {
     
		// TODO Auto-generated method stub
		QueryRunner runner = new QueryRunner(JdbcUtil.getDataSource());
		List<StuInfo> list = runner.query("select * from student_info where stclass = ?", new BeanListHandler<StuInfo>(StuInfo.class),stclass);
		return list;
	}




	@Override
	public List<StuInfo> searchStudent(String id, String name,String idclass, String gender, String identity) throws SQLException {
     
		System.out.println("现在要执行模糊查询了,收到的name ="+name + "==genser=="+gender);
		
		QueryRunner runner = new QueryRunner(JdbcUtil.getDataSource());
		
		//String sql = "select * from stu where sname=? or sgender=?";
		
		/*
		 * 这里要分析一下:
		 * 	如果只有姓名 ,select * from stu where sname like ? ;
		 * 	如果只有性别 , select * from stu where gender = ?
		 * 
		 * 如果两个都有 select * from stu where sname like ? and gender=?
		 * 
		 * 如果两个都没有就查询所有。
		 * 
		 */
		String sql = "select * from student_info where 1=1 ";
		List<String> list = new ArrayList<String> ();
		if(!TextUtils.isEmpty(id)){
     
			sql = sql + " and id like ?";
			list.add("%"+id+"%");
		}
		if(!TextUtils.isEmpty(name)){
     
			sql = sql + "  and name like ?";
			list.add("%"+name+"%");
		}
		if(!TextUtils.isEmpty(idclass)){
     
			sql = sql + "  and stclass like ?";
			list.add("%"+idclass+"%");
		}
				
		//判断有没有性别,有的话,就组拼到sql语句里面。
		if(!TextUtils.isEmpty(gender)){
     
			sql = sql + " and gender like ?";
			list.add("%"+gender+"%");
		}
		
		if(!TextUtils.isEmpty(identity)){
     
			sql = sql + "  and identity like ?";
			list.add(identity);
		}
		
		
		return runner.query(sql , new BeanListHandler<StuInfo>(StuInfo.class) ,list.toArray() );
		
	
	}



	//辅导员删除学生信息
	@Override
	public void deleteStuInfo(String id) throws SQLException {
     
		// TODO Auto-generated method stub
		QueryRunner runner = new QueryRunner(JdbcUtil.getDataSource());
		runner.update("delete from student_info where id=?" ,id);
		
	}




	@Override
	public void deleteStuUser(String id) throws SQLException {
     
		// TODO Auto-generated method stub
		QueryRunner runner = new QueryRunner(JdbcUtil.getDataSource());
		runner.update("delete from student_user where stid=?" ,id);
		
		
	}




	@Override
	public boolean modifyStuPass(String id, String password) throws SQLException {
     
		// TODO Auto-generated method stub
		QueryRunner runner = new QueryRunner(JdbcUtil.getDataSource());
		int update = runner.update("update student_user set stpassword = ? where stid = ?",password,id);
		return update>0;
	}

}

SCclassDaoImpl

package com.lmj.dao.daoimpl;

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

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

import com.lmj.dao.SCclassDao;
import com.lmj.daobean.SCclass;
import com.lmj.util.JdbcUtil;

public class SCclassDaoImpl implements SCclassDao {
     
	@Override
//添加到中间表
	public void addclass(SCclass cclass) throws SQLException {
     
		// TODO Auto-generated method stub
		
		QueryRunner runner = new QueryRunner(JdbcUtil.getDataSource());
		runner.update("insert into student_user values(?,?,?)",
				cclass.getStclass(),
				cclass.getCoclass()
				);
	}

	//查询班级
	@Override
	public List<SCclass> queryClass() throws SQLException {
     
		// TODO Auto-generated method stub
		QueryRunner runner = new QueryRunner(JdbcUtil.getDataSource());
		List<SCclass> list =runner.query("select * from scclass",new BeanListHandler<SCclass>(SCclass.class));
		return list;
/*		StuInfo stuInfo = runner.query("select * from student_info where id = ?",new BeanHandler(StuInfo.class),id);
	    return stuInfo;*/
		
	}

	@Override
	//添加新班级
	public void addNewClss(String stclass, String idclass, String coclass) throws SQLException {
     
		// TODO Auto-generated method stub
		QueryRunner runner = new QueryRunner(JdbcUtil.getDataSource());
		runner.update("insert into scclass values(?,?,?)",
				stclass,idclass,coclass
				);
	}

	@Override
	
	public SCclass queryRepeat(String idclass) throws SQLException {
     
		// TODO Auto-generated method stub
		QueryRunner runner = new QueryRunner(JdbcUtil.getDataSource());
		SCclass scclass = runner.query("select * from scclass where idclass = ?",new BeanHandler<SCclass>(SCclass.class),idclass);
		return scclass;
	}
	
	
}

4、service
service与dao一样让serviceimpl实现它的接口,提供给Servlet调用
在这里插入图片描述
5、serviceimpl
CounServiceImpl

package com.lmj.service.serviceimpl;

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

import com.lmj.dao.CounDao;
import com.lmj.dao.daoimpl.CounDaoImpl;
import com.lmj.daobean.CounClass;
import com.lmj.daobean.CounInfo;
import com.lmj.daobean.CounUser;
import com.lmj.service.CounService;

public class CounServiceImpl implements CounService {
     

	
	@Override
	public List<CounUser> repeat() throws SQLException {
     
		// TODO Auto-generated method stub
		CounDao dao = new CounDaoImpl(); 
		return dao.repeat();
	}

	

	@Override
	public CounUser counselorLogin(String coid) throws SQLException {
     
		// TODO Auto-generated method stub
		CounDao dao = new CounDaoImpl();
		return dao.counselorLogin(coid);
	}


	@Override
	public int counregistered(CounUser counUser) throws SQLException {
     
		// TODO Auto-generated method stub
		CounDao dao = new CounDaoImpl();
		return dao.counregistered(counUser);
	}



	@Override
	public void addcouinfo(CounInfo counInfo) throws SQLException {
     
		// TODO Auto-generated method stub
		CounDao dao = new CounDaoImpl();
		dao.addcouinfo(counInfo);
	}



	@Override
	public void addCoClass(CounClass ounClass) throws SQLException {
     
		// TODO Auto-generated method stub
		CounDao dao = new CounDaoImpl();
		dao.addCoClass(ounClass);
	}



	@Override
	public CounInfo queryCounInfo(String id) throws SQLException {
     
		// TODO Auto-generated method stub
		CounDao dao = new CounDaoImpl();
		return dao.queryCounInfo(id);
	}



	@Override
	public List<CounClass> queryCounClass(String id) throws SQLException {
     
		// TODO Auto-generated method stub
		CounDao dao = new CounDaoImpl();
		return dao.queryCounClass(id);
	}



	@Override
	public CounClass queryCounId(String stclass) throws SQLException {
     
		// TODO Auto-generated method stub
		CounDao dao = new CounDaoImpl();
		return dao.queryCounId(stclass);
	}



	@Override
	public void counAddClass(String coid,String name,String coclass) throws SQLException {
     
		// TODO Auto-generated method stub
		CounDao dao = new CounDaoImpl();
		dao.counAddClass(coid, name, coclass);
	}



	@Override
	public void deleteCounClass(String coclass) throws SQLException {
     
		// TODO Auto-generated method stub
		CounDao dao = new CounDaoImpl();
		dao.deleteCounClass(coclass);
	}



	@Override
	public void updeatCounInfo(String name, String phone, String email, String office, String id) throws SQLException {
     
		// TODO Auto-generated method stub
		CounDao dao = new CounDaoImpl();
		dao.updeatCounInfo(name, phone, email, office, id);
	}



	@Override
	public List<CounClass> queryClass() throws SQLException {
     
		// TODO Auto-generated method stub
		CounDao dao = new CounDaoImpl();
		return dao.queryClass();
	}



	@Override
	public boolean modifyCounPass(String id, String password) throws SQLException {
     
		// TODO Auto-generated method stub
		CounDao dao = new CounDaoImpl();
		return dao.modifyCounPass(id, password);
	}


}

SClassServiceImpl

package com.lmj.service.serviceimpl;

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

import com.lmj.dao.SCclassDao;
import com.lmj.dao.daoimpl.SCclassDaoImpl;
import com.lmj.daobean.SCclass;
import com.lmj.service.SClassService;

public class SClassServiceImpl implements SClassService {
     

	@Override
	public void addclass(SCclass cclass) throws SQLException {
     
		// TODO Auto-generated method stub
		SCclassDao dao = new SCclassDaoImpl();
		dao.addclass(cclass);
	}

	//学生编辑页面选择班级
	@Override
	public List<SCclass> queryClass() throws SQLException {
     
		// TODO Auto-generated method stub
		SCclassDao dao = new SCclassDaoImpl();
		return dao.queryClass();
	}

	@Override
	public void addNewClss(String stclass, String idclass, String coclass) throws SQLException {
     
		// TODO Auto-generated method stub
		SCclassDao dao = new SCclassDaoImpl();
		dao.addNewClss(stclass, idclass, coclass);
	}

	@Override
	public SCclass queryRepeat(String idclass) throws SQLException {
     
		// TODO Auto-generated method stub
		SCclassDao dao = new SCclassDaoImpl();
		return dao.queryRepeat(idclass);
	}

}

StuServiceImpl

package com.lmj.service.serviceimpl;

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

import com.lmj.dao.StuDao;
import com.lmj.dao.daoimpl.StuDaoImpl;
import com.lmj.daobean.StuInfo;
import com.lmj.daobean.StuUser;
import com.lmj.service.StuService;

public class StuServiceImpl implements StuService {
     

	@Override
	public int stregistered(StuUser stuUser) throws SQLException {
     
		// TODO Auto-generated method stub
		
		StuDao dao = new StuDaoImpl();
		return dao.stregistered(stuUser);
	}

	@Override
	public List<StuUser> repeat() throws SQLException {
     
		// TODO Auto-generated method stub
		StuDao dao = new StuDaoImpl(); 
		return dao.repeat();
	}

	@Override
	public StuUser studentLogin(String stid) throws SQLException {
     
		// TODO Auto-generated method stub
		StuDao dao = new StuDaoImpl();
		return dao.studentLogin(stid);
	}

	@Override
	public StuInfo queryStuInfo(String id) throws SQLException {
     
		// TODO Auto-generated method stub
		StuDao dao = new StuDaoImpl();
		return dao.queryStuInfo(id);
	}

	@Override
	public void addstuinfo(StuInfo stuInfo) throws SQLException {
     
		// TODO Auto-generated method stub
		StuDao dao = new StuDaoImpl();
		dao.addstuinfo(stuInfo);
	}

	@Override
	public void updateStu(StuInfo StuInfo) throws SQLException {
     
		// TODO Auto-generated method stub
		StuDao dao = new StuDaoImpl();
		dao.updateStu(StuInfo);
	}

/*	@Override
	public void addClass(String idclass, String id) throws SQLException {
		// TODO Auto-generated method stub
		StuDao dao = new StuDaoImpl();
		dao.addClass(idclass, id);
	}*/

	@Override
	public List<StuInfo> queryListStuInfo(String stclass) throws SQLException {
     
		// TODO Auto-generated method stub
		StuDao dao = new StuDaoImpl();
		return dao.queryListStuInfo(stclass);
	}

	@Override
	public List<StuInfo> searchStudent(String id, String name,String idclass, String gender, String identity) throws SQLException {
     
		// TODO Auto-generated method stub
		StuDao dao = new StuDaoImpl();
		return dao.searchStudent(id, name, idclass, gender, identity);
	}

	@Override
	public void deleteStuInfo(String id) throws SQLException {
     
		// TODO Auto-generated method stub
		StuDao dao = new StuDaoImpl();
		dao.deleteStuInfo(id);
	}

	@Override
	public void deleteStuUser(String id) throws SQLException {
     
		// TODO Auto-generated method stub
		StuDao dao = new StuDaoImpl();
		dao.deleteStuUser(id);
		
	}

	@Override
	public boolean modifyStuPass(String id, String password) throws SQLException {
     
		// TODO Auto-generated method stub
		StuDao dao = new StuDaoImpl();
		return dao.modifyStuPass(id, password);
	}

}

6、Servlet(由于实在太多截取一些主要的吧)
LoginServlet 登录

package com.lmj.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.lmj.daobean.CounUser;
import com.lmj.daobean.StuUser;
import com.lmj.service.CounService;
import com.lmj.service.StuService;
import com.lmj.service.serviceimpl.CounServiceImpl;
import com.lmj.service.serviceimpl.StuServiceImpl;
import com.lmj.util.LoginPromptUtil;

/**
 * Servlet implementation class LoginServlet
 */
public class LoginServlet extends HttpServlet {
     
	/**
	 * 
	 */
	//登录验证
	private static final long serialVersionUID = 1L;
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
     
		request.setCharacterEncoding("UTF-8");
		response.setContentType("text/html;charset=UTF-8");
		try {
     
			String id = request.getParameter("username");
			String password = request.getParameter("password");
			String user_types = request.getParameter("user_types");
				boolean b1 = LoginPromptUtil.loginPromptUserTypes(user_types);
				if (!b1) {
     
					request.getRequestDispatcher("promptHTML/login_user_types.html").forward(request, response);
				}
				boolean b2 = LoginPromptUtil.characterLenght(id);
				if (!b2) {
     
					request.getRequestDispatcher("promptHTML/login_username.html").forward(request, response);
				}
				boolean b3 = LoginPromptUtil.characterLenght(password);
				if (!b3) {
     
					request.getRequestDispatcher("promptHTML/login_password.html").forward(request, response);
				}
				if (b1 && b2 && b3) {
     
					//进行登录验证
					if(user_types.equals("1")) {
     
						StuService service = new StuServiceImpl();
						StuUser stuUser = service.studentLogin(id);
						if(stuUser == null) {
     
							request.getRequestDispatcher("promptHTML/prompt_stusername.html").forward(request, response);
						}
						String stpassword = stuUser.getStpassword();
						if (password.equals(stpassword)) {
     
							request.setAttribute("id", id);
							request.getRequestDispatcher("StuPageServlet").forward(request, response);
						}else {
     
							request.getRequestDispatcher("promptHTML/prompt_stpassword.html").forward(request, response);
						}
					}else if(user_types.equals("2")) {
     
						CounService service = new CounServiceImpl();
						CounUser counUser = service.counselorLogin(id);
						if(counUser == null) {
     
							request.getRequestDispatcher("promptHTML/prompt_stusername.html").forward(request, response);
						}
						String stpassword = counUser.getCopassword();
						if (password.equals(stpassword)) {
     
							request.setAttribute("id", id);
							request.getRequestDispatcher("CounPageServlet").forward(request, response);
						}else {
     
							request.getRequestDispatcher("promptHTML/prompt_stpassword.html").forward(request, response);
							
						}
					} 
				}
			
		} catch (Exception e) {
     
			// TODO: handle exception
		}
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
     
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}

RegisteredServlet 注册

package com.lmj.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.lmj.daobean.CounInfo;
import com.lmj.daobean.CounUser;
import com.lmj.daobean.StuInfo;
import com.lmj.daobean.StuUser;
import com.lmj.service.CounService;
import com.lmj.service.StuService;
import com.lmj.service.serviceimpl.CounServiceImpl;
import com.lmj.service.serviceimpl.StuServiceImpl;
import com.lmj.util.LoginPromptUtil;

/**
 * @Servlet implementation class RegisteredServlet
 */
public class RegisteredServlet extends HttpServlet {
     
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public RegisteredServlet() {
     
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
    
    /*
     * 接收用户注册提交的数据判断是否合法
     * */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
     
		
		request.setCharacterEncoding("UTF-8");
		response.setContentType("text/html;charset=UTF-8");
		boolean Flag = true;
		try {
     
			String user_types = request.getParameter("user_types");
			String userid = request.getParameter("userid");
			String password = request.getParameter("password");
			String name = request.getParameter("name");
			boolean b1 = LoginPromptUtil.loginPromptUserTypes(user_types);
			if (!b1) {
     
				request.getRequestDispatcher("promptHTML/prompt_user_types.html").forward(request, response);
			}
			boolean b2 = LoginPromptUtil.characterLenght(userid);
			if (!b2) {
     
				request.getRequestDispatcher("promptHTML/prompt_username.html").forward(request, response);
			}
			boolean b3 = LoginPromptUtil.characterLenght(password);
			if (!b3) {
     
				request.getRequestDispatcher("promptHTML/prompt_password.html").forward(request, response);
			}
			boolean b4 = LoginPromptUtil.characterLenght(name);
			if (!b4) {
     
				request.getRequestDispatcher("promptHTML/prompt_name.html").forward(request, response);
			}
			
			if (b1 && b2 && b3 && b4) {
     
				if(user_types.equals("学生")) {
     
				//查询是否重复
					StuService service = new StuServiceImpl();
					List<StuUser> list = service.repeat();
					for (StuUser stuUser : list) {
     
						if(stuUser.getStid().equals(userid)) {
     
							request.getRequestDispatcher("promptHTML/user_repeat.html").forward(request, response);
							Flag = false;
							break;
						}
					}
					if(Flag) {
     
						StuInfo stuInfo = new StuInfo(userid, name);
						service.addstuinfo(stuInfo);
						StuUser stuUser = new StuUser(userid, password, name);
						int i = service.stregistered(stuUser);
						if(i>0) {
     
							request.getRequestDispatcher("promptHTML/skip_index.html").forward(request, response);
						}else {
     
							response.getWriter().write("注册失败!");
						}
					}
					
				}else if(user_types.equals("辅导员")){
     
					CounService service = new CounServiceImpl();
					List<CounUser> list = service.repeat();
					for (CounUser counUser : list) {
     
						if(counUser.getCoid().equals(userid)) {
     
							request.getRequestDispatcher("promptHTML/user_repeat.html").forward(request, response);
							Flag = false;
							break;
						}
					}
					
					if(Flag) {
     
						CounInfo counInfo = new CounInfo(userid, name);
						service.addcouinfo(counInfo);
						CounUser counUser = new CounUser(userid, name, password);
						int i = service.counregistered(counUser);
						if(i>0) {
     
							request.getRequestDispatcher("promptHTML/skip_index.html").forward(request, response);
						}else {
     
							response.getWriter().write("注册失败!");
						}
					}
				}else if(user_types.equals("user_types")){
     
					request.getRequestDispatcher("promptHTML/registere_prompt_user_types.html").forward(request, response);
				}
			}
		} catch (Exception e) {
     
			// TODO: handle exception
		}
	
	
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
     
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}

AddClassServlet 添加班级

package com.lmj.servlet;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.lmj.daobean.CounClass;
import com.lmj.daobean.SCclass;
import com.lmj.service.CounService;
import com.lmj.service.SClassService;
import com.lmj.service.serviceimpl.CounServiceImpl;
import com.lmj.service.serviceimpl.SClassServiceImpl;

/**
 * Servlet implementation class AddClassServlet
 */
public class AddClassServlet extends HttpServlet {
     
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public AddClassServlet() {
     
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
    //查询班级列表
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
     
		// TODO Auto-generated method stub
		request.setCharacterEncoding("UTF-8");
		response.setContentType("text/html;charset=UTF-8");
		try {
     
			
			List<String> list4 = new ArrayList<>();
			List<String> list3 = new ArrayList<>();
			
			String id = request.getParameter("id");
			String name = request.getParameter("name");
			request.setAttribute("coid", id);
			request.setAttribute("coname", name);
			
			
			//辅导员已经选的班级表
			CounService counService = new CounServiceImpl();
			List<CounClass> list1 = counService.queryClass();
			
			for (CounClass counClass : list1) {
     
				list4.add(counClass.getCoclass());
			}
			
			//全部班级表
			SClassService service = new SClassServiceImpl();
			List<SCclass> list = service.queryClass();
			for (SCclass sCclass : list) {
     
				list3.add(sCclass.getIdclass());
			}
			list3.removeAll(list4);
			request.setAttribute("list1", list1);
			request.setAttribute("list3", list3);
			//3. 跳转界面。列表界面
			request.getRequestDispatcher("addclass.jsp").forward(request, response);
			
		} catch (Exception e) {
     
			// TODO: handle exception
		}
		
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
     
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}

AddClassTableServlet 添加班级列表

package com.lmj.servlet;


import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.lmj.service.CounService;
import com.lmj.service.serviceimpl.CounServiceImpl;

/**
 * Servlet implementation class AddClassServlet
 */
public class AddClassTableServlet extends HttpServlet {
     
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public AddClassTableServlet() {
     
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	/* (non-Javadoc)
	 * @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
	 */
    //存储辅导员提交添加班级的的数据
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
     
		// TODO Auto-generated method stub
		request.setCharacterEncoding("UTF-8");
		response.setContentType("text/html;charset=UTF-8");
		//先查询老师的
		
		try {
     
			String coid = request.getParameter("coid");
			String coname = request.getParameter("coname");
			request.setAttribute("id", coid);
			//查询班级列表
			String[] h = request.getParameterValues("idclass");
			if(h==null || (h!=null && h.length==0)) {
     
				//提示没有选择班级
				request.getRequestDispatcher("promptHTML/dataNull.jsp").forward(request, response);
			}
			else {
     
				for (String string : h) {
     
					//存到数据
					CounService service = new CounServiceImpl();
					service.counAddClass(coid, coname, string);
				} 
				request.getRequestDispatcher("CounPageServlet").forward(request, response);
			}
			
		} catch (Exception e) {
     
			// TODO: handle exception
		}
		
		
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
     
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}

AddNewClassServlet 添加新班级

package com.lmj.servlet;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class AddNewClassServlet
 */
public class AddNewClassServlet extends HttpServlet {
     
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public AddNewClassServlet() {
     
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
     
		request.setCharacterEncoding("UTF-8");
		response.setContentType("text/html;charset=UTF-8");
		String id = request.getParameter("id");
		String name = request.getParameter("name");
		request.setAttribute("id", id);
		request.setAttribute("name", name);
		request.getRequestDispatcher("addNewclass.jsp").forward(request, response);
	
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
     
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}

AddStudentInfoServlet 添加学生信息

package com.lmj.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.lmj.daobean.StuInfo;
import com.lmj.daobean.StuUser;
import com.lmj.service.StuService;
import com.lmj.service.serviceimpl.StuServiceImpl;
import com.lmj.util.LoginPromptUtil;

/**
 * Servlet implementation class AddStudentInfoServlet
 */
public class AddStudentInfoServlet extends HttpServlet {
     
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public AddStudentInfoServlet() {
     
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
    //辅导员添加学生信息,添加成功后跳转QueryAddStudentInfoServlet重新进行查询该班级的学生(更新表)
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
     
		// TODO Auto-generated method stub
		request.setCharacterEncoding("UTF-8");
		response.setContentType("text/html;charset=UTF-8");
		try {
     
			boolean Flag = true;
			String id = request.getParameter("id");
			String name = request.getParameter("name");
			String stclass = request.getParameter("stclass");
			String gender = request.getParameter("gender");
			String phone = request.getParameter("phone");
			String address = request.getParameter("address");
			String email = request.getParameter("email");
			String birthday = request.getParameter("birthday");
			String identity = request.getParameter("identity");
			String dormitory = request.getParameter("dormitory");
			String password = "abc123";
			request.setAttribute("stclass", stclass);
			//学生免去注册存到学生用户表默认密码abc123
			//判断老师添加学生时是否添加了学号和姓名(必填)
			boolean b1 = LoginPromptUtil.characterLenght(id);
			if (!b1) {
     
				request.getRequestDispatcher("promptHTML/addStuInfoId.jsp").forward(request, response);
			}
			boolean b2 = LoginPromptUtil.characterLenght(name);
			if (!b2) {
     
				request.getRequestDispatcher("promptHTML/addStuInfoName.jsp").forward(request, response);
			}
			if (b1 && b2) {
     

				//查询是否重复
				StuService service = new StuServiceImpl();
				List<StuUser> list = service.repeat();
				for (StuUser stuUser : list) {
     
					if (stuUser.getStid().equals(id)) {
     
						response.getWriter().write("添加失败!该学号已经存在");
						//request.getRequestDispatcher("promptHTML/user_repeat.html").forward(request, response);
						Flag = false;
						break;
					}
				}

				if (Flag) {
     
					//存到学生信息表
					StuInfo stuInfo = new StuInfo(id, name, gender, stclass, phone, address, email, birthday, identity, dormitory);
					service.addstuinfo(stuInfo);
					//存到学生用户表
					StuUser stuUser = new StuUser(id, password, name);
					System.out.println(stuUser.getStid());
					System.out.println(stuUser.getStpassword());
					System.out.println(stuUser.getStname());
					int i = service.stregistered(stuUser);
					if (i > 0) {
     
						request.getRequestDispatcher("QueryAddStudentInfoServlet").forward(request, response);
					} else {
     
						response.getWriter().write("添加失败!");
					}
				}

			} else {
     
				response.getWriter().write("添加失败!");
			} 
		} catch (Exception e) {
     
			// TODO: handle exception
		}
		
		
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
     
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}

CounPageServlet 辅导员界面的后台需要数据

package com.lmj.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.lmj.daobean.CounClass;
import com.lmj.daobean.CounInfo;
import com.lmj.service.CounService;
import com.lmj.service.serviceimpl.CounServiceImpl;

/**
 * Servlet implementation class CounPageServlet
 */
public class CounPageServlet extends HttpServlet {
     
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public CounPageServlet() {
     
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
    
    //辅导员登录成功后获取辅导员的id查询个人信息和管理班级发送到counIndex.jsp页面
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
     
		// TODO Auto-generated method stub
		request.setCharacterEncoding("UTF-8");
		response.setContentType("text/html;charset=UTF-8");
		//查询辅导员信息
		
		try {
     
			String id = (String) request.getAttribute("id");
			//查询辅导员个人信息
			CounService service = new CounServiceImpl();
			CounInfo counInfo = service.queryCounInfo(id);
			//request.setAttribute("id", counInfo.getId());
			request.setAttribute("counInfo", counInfo);
			
			//查询辅导员班级班级表
			List<CounClass> list = service.queryCounClass(id);
			request.setAttribute("list", list);
			
			request.getRequestDispatcher("counIndex.jsp").forward(request, response);
		} catch (Exception e) {
     
			// TODO: handle exception
		}
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
     
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}

辅导员删除班级

package com.lmj.servlet;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.lmj.service.CounService;
import com.lmj.service.serviceimpl.CounServiceImpl;

/**
 * Servlet implementation class DeleteCounClassServlet
 */
//辅导员删除班级
public class DeleteCounClassServlet extends HttpServlet {
     
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public DeleteCounClassServlet() {
     
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
     
		// TODO Auto-generated method stub
		//删除班级
		try {
     
			String coclass = request.getParameter("coclass");
			String coid = request.getParameter("coid");
			request.setAttribute("id", coid);
			CounService service = new CounServiceImpl();
			service.deleteCounClass(coclass);
			
			request.getRequestDispatcher("CounPageServlet").forward(request, response);
		
		} catch (Exception e) {
     
			// TODO: handle exception
		}
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
     
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}

DeleteStuInfoServlet 删除学生信息

package com.lmj.servlet;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.lmj.daobean.StuInfo;
import com.lmj.service.StuService;
import com.lmj.service.serviceimpl.StuServiceImpl;

/**
 * Servlet implementation class DeleteStuInfoServlet
 */
public class DeleteStuInfoServlet extends HttpServlet {
     
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public DeleteStuInfoServlet() {
     
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
    
    //删除学生信息
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
     
		// TODO Auto-generated method stub
		
		try {
     
			
			String id = request.getParameter("id");
			StuService service = new StuServiceImpl();
			StuInfo info = service.queryStuInfo(id);
			String stclass = info.getStclass();
			service.deleteStuInfo(id);
			service.deleteStuUser(id);
			request.setAttribute("stclass", stclass);
			request.getRequestDispatcher("QueryAddStudentInfoServlet").forward(request, response);
		} catch (Exception e) {
     
			// TODO: handle exception
		}
		
		
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
     
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}

EditServlet 更新信息

package com.lmj.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.lmj.daobean.SCclass;
import com.lmj.daobean.StuInfo;
import com.lmj.service.SClassService;
import com.lmj.service.StuService;
import com.lmj.service.serviceimpl.SClassServiceImpl;
import com.lmj.service.serviceimpl.StuServiceImpl;

/**
 * Servlet implementation class EditServlet
 */
public class EditServlet extends HttpServlet {
     
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public EditServlet() {
     
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
    /*
     * 获取学生原有信息给编辑页面,提供更新参考
     * */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
     
		
		request.setCharacterEncoding("UTF-8");
		response.setContentType("text/html;charset=UTF-8");
		try {
     
			// TODO Auto-generated method stub
			String id = request.getParameter("id");
			//查询所有班级提供选择下拉列表
			SClassService service1 = new SClassServiceImpl();
			List<SCclass> list = service1.queryClass();
			request.setAttribute("list", list);
			StuService service = new StuServiceImpl();
			StuInfo stuInfo = service.queryStuInfo(id);
			request.setAttribute("stuInfo", stuInfo);
			request.getRequestDispatcher("edit.jsp").forward(request, response);
			
			
		} catch (Exception e) {
     
			// TODO: handle exception
		}
		
		
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
     
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}

JumpAddStudentInfoServlet 添加信息

package com.lmj.servlet;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class JumpAddStudentInfoServlet
 */
public class JumpAddStudentInfoServlet extends HttpServlet {
     
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public JumpAddStudentInfoServlet() {
     
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
    //跳转添加页面,将将辅导员传过来的班级存储发送带addStudentInfo.jsp
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
     
		// TODO Auto-generated method stub
		request.setCharacterEncoding("UTF-8");
		response.setContentType("text/html;charset=UTF-8");
		String stclass = request.getParameter("stclass");
		request.setAttribute("stclass", stclass);
		request.getRequestDispatcher("addStudentInfo.jsp").forward(request, response);
		
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
     
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}

ModifyCounPassServlet 修改密码

package com.lmj.servlet;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.lmj.service.CounService;
import com.lmj.service.serviceimpl.CounServiceImpl;
import com.lmj.util.LoginPromptUtil;

/**
 * Servlet implementation class ModifyCounPassServlet
 */
public class ModifyCounPassServlet extends HttpServlet {
     
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public ModifyCounPassServlet() {
     
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
    //修改辅导员密码
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
     
		try {
     
			request.setCharacterEncoding("UTF-8");
			response.setContentType("text/html;charset=UTF-8");
			String id = request.getParameter("id");
			String password = request.getParameter("password");
			boolean bnull = LoginPromptUtil.characterLenght(password);
			if(bnull) {
     
				CounService service = new CounServiceImpl();
				boolean b = service.modifyCounPass(id, password);
				System.out.println(b);
				if(b) {
     
					request.getRequestDispatcher("promptHTML/modifypassword.jsp").forward(request, response);
				}else {
     
					response.getWriter().write("修改失败!!!");
				}
				
			}else {
     
				response.getWriter().write("密码不能为空!!!");
				
			}
			
		} catch (Exception e) {
     
			// TODO: handle exception
		}
		
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
     
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}

QueryAddStudentInfoServlet 添加学生信息

package com.lmj.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.lmj.daobean.StuInfo;
import com.lmj.service.StuService;
import com.lmj.service.serviceimpl.StuServiceImpl;

/**
 * Servlet implementation class QueryAddStudentInfoServlet
 */
public class QueryAddStudentInfoServlet extends HttpServlet {
     
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public QueryAddStudentInfoServlet() {
     
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
    //查询辅导员添加成功后的重新查询学生信息表,显示list_stu.jsp
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
     
		// TODO Auto-generated method stub
		request.setCharacterEncoding("UTF-8");
		response.setContentType("text/html;charset=UTF-8");
		try {
     
			String stclass = (String) request.getAttribute("stclass");
			request.setAttribute("stclass", stclass);
			System.out.println(stclass);
			//根据班级查学生
			StuService service = new StuServiceImpl();
			List<StuInfo> list = service.queryListStuInfo(stclass);
			
			request.setAttribute("list", list);
			request.getRequestDispatcher("list_stu.jsp").forward(request, response);
		} catch (Exception e) {
     
			// TODO: handle exception
		}
		
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
     
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}

QueryAllStudentServlet 查看管理的全体学生信息列表

package com.lmj.servlet;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.lmj.daobean.CounClass;
import com.lmj.daobean.StuInfo;
import com.lmj.service.CounService;
import com.lmj.service.StuService;
import com.lmj.service.serviceimpl.CounServiceImpl;
import com.lmj.service.serviceimpl.StuServiceImpl;

/**
 * Servlet implementation class QueryAllStudentServlet
 */
public class QueryAllStudentServlet extends HttpServlet {
     
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public QueryAllStudentServlet() {
     
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	//查询全部学生信息
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
     
		// TODO Auto-generated method stub
		request.setCharacterEncoding("UTF-8");
		response.setContentType("text/html;charset=UTF-8");
		
		try {
     
			List<StuInfo> list2 = new ArrayList<>();
			String id = request.getParameter("id");
			request.setAttribute("id", id);
			CounService service = new CounServiceImpl();
			List<CounClass> list = service.queryCounClass(id);
			for (CounClass counClass : list) {
     
				String counclass = counClass.getCoclass();
				//根据班级查询学生
				StuService service1 = new StuServiceImpl();
				List<StuInfo> list1 = service1.queryListStuInfo(counclass);
				list2.addAll(list1);
			}
			request.setAttribute("list", list2);
			request.getRequestDispatcher("list_counAllstu.jsp").forward(request, response);
		} catch (Exception e) {
     
			// TODO: handle exception
		}
		
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
     
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}

QueryStCounInfoServlet 学生查询所属辅导员信息

package com.lmj.servlet;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.lmj.daobean.CounClass;
import com.lmj.daobean.CounInfo;
import com.lmj.service.CounService;
import com.lmj.service.serviceimpl.CounServiceImpl;
import com.lmj.util.LoginPromptUtil;

/**
 * Servlet implementation class QueryStCounInfoServlet
 */
public class QueryStCounInfoServlet extends HttpServlet {
     
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public QueryStCounInfoServlet() {
     
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
    //学生查看辅导员信息
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
     
		// TODO Auto-generated method stub
		request.setCharacterEncoding("UTF-8");
		response.setContentType("text/html;charset=UTF-8");
		try {
     
			String stclass = request.getParameter("stclass");
			if(!LoginPromptUtil.characterLenght(stclass)) {
     
				response.getWriter().write("请您先在编辑个人信息中,添加班级");
			}else {
     
				CounService service = new CounServiceImpl();
				CounClass counClass = service.queryCounId(stclass);
				if(counClass != null ) {
     
					String id = counClass.getCoid();
					CounService service1 = new CounServiceImpl();
					CounInfo counInfo = service1.queryCounInfo(id);
					request.setAttribute("counInfo", counInfo);
					request.getRequestDispatcher("couninfo.jsp").forward(request, response);
				}else {
     
					response.getWriter().write("该班级还没有辅导员选择,请及时通知他!");
				}
			}
			
		} catch (Exception e) {
     
			// TODO: handle exception
		}
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
     
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}

QueryStuInfoServlet 查看班级学生列表

package com.lmj.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.lmj.daobean.StuInfo;
import com.lmj.service.StuService;
import com.lmj.service.serviceimpl.StuServiceImpl;

/**
 * Servlet implementation class QueryStuInfoServlet
 */
public class QueryStuInfoServlet extends HttpServlet {
     
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public QueryStuInfoServlet() {
     
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
    
    //辅导员点击查看该班级信息后跳转到这里获取该班id对该班级进行查询,把查到的数据发送到list_stu.jsp显示
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
     
		// TODO Auto-generated method stub
		request.setCharacterEncoding("UTF-8");
		response.setContentType("text/html;charset=UTF-8");
		try {
     
			String stclass = request.getParameter("stclass");
			request.setAttribute("stclass", stclass);
			System.out.println(stclass);
			//根据班级查学生
			StuService service = new StuServiceImpl();
			List<StuInfo> list = service.queryListStuInfo(stclass);
			request.setAttribute("list", list);
			request.getRequestDispatcher("list_stu.jsp").forward(request, response);
			
			
		} catch (Exception e) {
     
			// TODO: handle exception
		}
		
		
		
	
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
     
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}

SearchCounServlet 辅导员模糊查询功能

package com.lmj.servlet;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.lmj.daobean.CounClass;
import com.lmj.daobean.StuInfo;
import com.lmj.service.CounService;
import com.lmj.service.StuService;
import com.lmj.service.serviceimpl.CounServiceImpl;
import com.lmj.service.serviceimpl.StuServiceImpl;

/**
 * Servlet implementation class SearchCounServlet
 */
public class SearchCounServlet extends HttpServlet {
     
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public SearchCounServlet() {
     
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
    //查询全部学生信息时模糊查询
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
     
		// TODO Auto-generated method stub
		request.setCharacterEncoding("UTF-8");
		response.setContentType("text/html;charset=UTF-8");
		
		
		try {
     
			
			String name = request.getParameter("stname");
			System.out.println(name);
			String stuid = request.getParameter("stid");
			System.out.println(stuid);
			String id = request.getParameter("id");
			request.setAttribute("id", id);
			System.out.println(id);
			
			List<StuInfo> list2 = new ArrayList<>();
			List<StuInfo> list3 = new ArrayList<>();
			
			//查询辅导员与班级表
			CounService service = new CounServiceImpl();
			List<CounClass> list = service.queryCounClass(id);
			
			request.setAttribute("list", list);
			for (CounClass counClass : list) {
     
				String counclass = counClass.getCoclass();
				//根据班级查询学生
				StuService service1 = new StuServiceImpl();
				List<StuInfo> list1 = service1.queryListStuInfo(counclass);
				list2.addAll(list1);
			}
			//list2存放了老师管理的所有学生信息
			for (StuInfo stuInfo : list2) {
     
				if(name.equals(stuInfo.getName())||stuid.equals(stuInfo.getId())) {
     
					list3.add(stuInfo);
				}else {
     
					//提示未找到
					response.getWriter().write("查询结果为NULL!");
					
				}
			}
			
			for (StuInfo stuInfo : list3) {
     
				System.out.println(stuInfo);
			}
			request.setAttribute("list", list3);
			request.getRequestDispatcher("list_Coun_Search.jsp").forward(request, response);
		} catch (Exception e) {
     
			// TODO: handle exception
		}
		
		
	
		
		
		
		
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
     
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}

SearchStudentServlet 模糊查询结果

package com.lmj.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.lmj.daobean.StuInfo;
import com.lmj.service.StuService;
import com.lmj.service.serviceimpl.StuServiceImpl;

/**
 * Servlet implementation class SearchStudentServlet
 */
public class SearchStudentServlet extends HttpServlet {
     
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public SearchStudentServlet() {
     
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
    
    //辅导员进行模糊查询学生信息,把查到的信息发送到list_stu.jsp显示
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
     
		// TODO Auto-generated method stub
		request.setCharacterEncoding("UTF-8");
		response.setContentType("text/html;charset=UTF-8");
		
			try {
     
				String id = request.getParameter("stid");
				String name = request.getParameter("stname");
				String idclass = request.getParameter("idclass");
				request.setAttribute("idclass", idclass);
				String gender = request.getParameter("stgender");
				String identity = request.getParameter("identity");
				//如果什么都没有就点击查询只能查看该班级

					//进行模糊查询
					StuService service = new StuServiceImpl();
					List<StuInfo> list = service.searchStudent(id, name, idclass, gender, identity);
					
					//先获取stclass,在把stclass存到list_syu.jsp获取
					
/*					StuInfo info = list.get(0);
					String stclass = info.getStclass();
					System.out.println("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&");
					System.out.println("&&&&&&&&&&&&&="+stclass);
					request.setAttribute("idclass", stclass);*/
		
					
					for (StuInfo stuInfo : list) {
     
						stuInfo.getStclass();
					}
					
					request.setAttribute("list", list);
					//跳转
					request.getRequestDispatcher("list_stu.jsp").forward(request, response);

			} catch (Exception e) {
     
				// TODO: handle exception
			}
			
			
		
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
     
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}

StuPageServlet 学生登录成功所需数据

package com.lmj.servlet;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.lmj.daobean.StuInfo;
import com.lmj.service.StuService;
import com.lmj.service.serviceimpl.StuServiceImpl;

/**
 * Servlet implementation class StuPageServlet
 */
public class StuPageServlet extends HttpServlet {
     
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public StuPageServlet() {
     
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
    
    /*
     * 学生用户登录成功,获取他们的信息到页面
     */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
     
		// TODO Auto-generated method stub
		
		request.setCharacterEncoding("UTF-8");
		response.setContentType("text/html;charset=UTF-8");
		try {
     
			String id = (String) request.getAttribute("id");
			StuService service = new StuServiceImpl();
			StuInfo stuInfo = service.queryStuInfo(id);
			request.setAttribute("stuInfo", stuInfo);
			request.getRequestDispatcher("list_page.jsp").forward(request, response);
		} catch (Exception e) {
     
			// TODO: handle exception
		}
		
		
		
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
     
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}

UpdateCounInfoServlet 更新辅导员信息

package com.lmj.servlet;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.lmj.service.CounService;
import com.lmj.service.serviceimpl.CounServiceImpl;

/**
 * Servlet implementation class UpdateCounInfoServlet
 */
public class UpdateCounInfoServlet extends HttpServlet {
     
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public UpdateCounInfoServlet() {
     
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
    
    //更新辅导员信息
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
     
		
		request.setCharacterEncoding("UTF-8");
		response.setContentType("text/html;charset=UTF-8");
		
		try {
     
			// TODO Auto-generated method stub
			String id = request.getParameter("id");
			String name = request.getParameter("name");
			String phone = request.getParameter("phone");
			String email = request.getParameter("email");
			String office = request.getParameter("office");
			request.setAttribute("id", id);
			CounService service = new CounServiceImpl();
			service.updeatCounInfo(name, phone, email, office, id);
			//还用修改辅导员班级表的姓名信息
			request.getRequestDispatcher("CounPageServlet").forward(request, response);
			
		} catch (Exception e) {
     
			// TODO: handle exception
		}
		
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
     
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}

UpdateServlet 更新学生信息

package com.lmj.servlet;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.lmj.daobean.StuInfo;
import com.lmj.service.StuService;
import com.lmj.service.serviceimpl.StuServiceImpl;

/**
 * Servlet implementation class UpdateStudentInfoServlet
 */
public class UpdateStudentInfoServlet extends HttpServlet {
     
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public UpdateStudentInfoServlet() {
     
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
     
		// TODO Auto-generated method stub
		request.setCharacterEncoding("UTF-8");
		response.setContentType("text/html;charset=UTF-8");
		
			try {
     
				String id = request.getParameter("id");
				String name = request.getParameter("name");
				String gender = request.getParameter("gender");
				String stclass = request.getParameter("stclass");
				String idclass = request.getParameter("idclass");
				request.setAttribute("stclass", idclass);
				String phone = request.getParameter("phone");
				String address = request.getParameter("address");
				String email = request.getParameter("email");
				String birthday = request.getParameter("birthday");
				String identity = request.getParameter("identity");
				String dormitory = request.getParameter("dormitory");
				System.out.println("id=" + id);
				System.out.println(stclass);
				StuInfo stuInfo = new StuInfo(id, name, gender, stclass, phone, address, email, birthday, identity,
						dormitory);
				StuService service = new StuServiceImpl();
				service.updateStu(stuInfo);
				request.getRequestDispatcher("QueryAddStudentInfoServlet").forward(request, response);
			} catch (Exception e) {
     
				// TODO: handle exception
			}
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
     
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}


7、Util
JdbcUtil JDBC配置

package com.lmj.util;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import javax.sql.DataSource;

import com.mchange.v2.c3p0.ComboPooledDataSource;

public class JdbcUtil {
     

	//使用c3p0时打开
	
	static ComboPooledDataSource dataSource = null;
	static{
     
		dataSource = new ComboPooledDataSource();
	}
	
	public static DataSource getDataSource(){
     
		return dataSource;
	}
	//获取连接对象
	public static Connection getConn() throws SQLException{
     
		return dataSource.getConnection();
	}
	
	
	/**
	 * 释放资源
	 * @param conn
	 * @param st
	 * @param rs
	 */
	public static void release(Connection conn , Statement st , ResultSet rs){
     
		closeRs(rs);
		closeSt(st);
		closeConn(conn);
	}
	public static void release(Connection conn , Statement ps){
     
		closeSt(ps);
		closeConn(conn);
	}

	//释放ResultSet
	private static void closeRs(ResultSet rs){
     
		try {
     
			if(rs != null){
     
				rs.close();
			}
		} catch (SQLException e) {
     
			e.printStackTrace();
		}finally{
     
			rs = null;
		}
	}
	
	//释放Statement
	private static void closeSt(Statement st){
     
		try {
     
			if(st != null){
     
				st.close();
			}
		} catch (SQLException e) {
     
			e.printStackTrace();
		}finally{
     
			st = null;
		}
	}
	
	//释放Connection
	private static void closeConn(Connection conn){
     
		try {
     
			if(conn != null){
     
				conn.close();
			}
		} catch (SQLException e) {
     
			e.printStackTrace();
		}finally{
     
			conn = null;
		}
	}
}

8、C3P0(记得改数据库和密码)


<c3p0-config>
  <default-config>
    <property name="driverClass">com.mysql.jdbc.Driverproperty>
    <property name="jdbcUrl">jdbc:mysql://localhost/info?useUnicode=true&characterEncoding=UTF-8property>
    <property name="user">rootproperty>
    <property name="password">lmj1314property>
    <property name="initialPoolSize">10property>
    <property name="maxIdleTime">30property>
    <property name="maxPoolSize">100property>
    <property name="minPoolSize">10property>
    <property name="maxStatements">200property>
  default-config>
   
  <named-config name="oracle"> 
    <property name="acquireIncrement">50property>
    <property name="initialPoolSize">100property>
    <property name="minPoolSize">50property>
    <property name="maxPoolSize">1000property>
    
    <property name="maxStatements">0property> 
    <property name="maxStatementsPerConnection">5property>
    
    <user-overrides user="master-of-the-universe"> 
      <property name="acquireIncrement">1property>
      <property name="initialPoolSize">1property>
      <property name="minPoolSize">1property>
      <property name="maxPoolSize">5property>
      <property name="maxStatementsPerConnection">50property>
    user-overrides>
  named-config>
c3p0-config>
	

9、JSP
学生信息管理系统/辅导员信息管理系统_第11张图片

index.jsp

<%@ page language="java" import="java.sql.*" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
   <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
   <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>首页title>

<link href="css/login.css" rel="stylesheet" type="text/css" />
<script type='text/javascript'>
 
 function ChangeColora()
 {
      
  document.getElementById('a').style.backgroundColor="#0C3761"
 }
 function RevertColora()
 {
      
  document.getElementById('a').style.backgroundColor="#141526"
 }
 function ChangeColorb()
 {
      
  document.getElementById('b').style.backgroundColor="#0C3761"
 }
 function RevertColorb()
 {
      
  document.getElementById('b').style.backgroundColor="#141526"
 }
 
script>
<style type="text/css">
 body 
{
      
	 background-image:url('images/indexbackground.jpg'); 
} 
style>
head>

<body>
<div class="size">
<p>欢迎使用p>
<p>辅导员信息管理系统p>
div>
	<div  class="login_box">
		<div class="login">
			<div class="login_logo">
			<img src="images/login_logo.png" />
			div>
			<div class="login_name">
				<p>欢迎登录p>
			div>
			<form  name="form" action="LoginServlet" method="post">
				<select name="user_types" style="font-size:20px;color:#E3E6F3;background: #141526;border: 1">
				  <option value="0" style="display:none">请选择用户类型option>
				  <option value="1">学生option>
				  <option value="2">辅导员option>
				select><br>
				
				 <span id="username_text" onclick="this.style.display='none';document.getElementById('username').style.display='block';document.getElementById('username').focus().select();">
				        学号/工号span>
				<input name="username" type="text" id="username" style="display: none;"
					onblur="if(this.value==''){document.getElementById('username_text').style.display='block';this.style.display='none'};" />
					 
					 <span id="password_text" onclick="this.style.display='none';document.getElementById('password').style.display='block';document.getElementById('password').focus().select();">
					密码span>
				<input name="password" type="password" id="password" style="display: none;"
					onblur="if(this.value==''){document.getElementById('password_text').style.display='block';this.style.display='none'};" />
				
			<input id='a' type='submit' value='登录' style="width: 100%;" style='background:#141526' onMouseOver='ChangeColora()' onMouseout='RevertColora()'>
				<br><br>
				<a href="JumpRegisterServlet"><input id='b' type='button' value='注册' style="width: 100%;" style='background:#141526' onMouseOver='ChangeColorb()' onMouseout='RevertColorb()'>a>
			form>
		div>
		div>
body>
html>

counindex,jsp

<%@page import="com.lmj.daobean.CounInfo"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
   <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
   <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
    

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>辅导员管理title>
<script type='text/javascript'>

function doPost(to, p) {
       // to:提交动作(action),p:参数  
	var myForm = document.createElement("form");
	myForm.method = "post";
	myForm.action = to;
	for ( var i in p) {
      
		var myInput = document.createElement("input");
		myInput.setAttribute("name", i); // 为input对象设置name  
		myInput.setAttribute("value", p[i]); // 为input对象设置value  
		myForm.appendChild(myInput);
	}
	document.body.appendChild(myForm);
	myForm.submit();
	document.body.removeChild(myForm); // 提交后移除创建的form  
}


 
 function ChangeColora()
 {
      
  document.getElementById('a').style.backgroundColor="#8396E7"
 }
 function RevertColora()
 {
      
  document.getElementById('a').style.backgroundColor="#D0DFEF"
 }
 function ChangeColorb()
 {
      
  document.getElementById('b').style.backgroundColor="#8396E7"
 }
 function RevertColorb()
 {
      
  document.getElementById('b').style.backgroundColor="#D0DFEF"
 }
 function ChangeColorc()
 {
      
  document.getElementById('c').style.backgroundColor="#8396E7"
 }
 function RevertColorc()
 {
      
  document.getElementById('c').style.backgroundColor="#D0DFEF"
 }
 function ChangeColord()
 {
      
  document.getElementById('d').style.backgroundColor="#8396E7"
 }
 function RevertColord()
 {
      
  document.getElementById('d').style.backgroundColor="#D0DFEF"
 }
 
 function deleteclass(coclass,coid){
      

	 var flag = confirm("是否确定删除?");
		if(flag){
      
			window.location.href="DeleteCounClassServlet?coclass="+coclass+"&coid="+coid;
		}

	 }

script>

<style type="text/css">
 body 
{
      
	 background: #D1E0EF; 
} 
style>

head>
<body>
<br><br>
<table border="2" width="1000px" align="center" >
    <tr height="50px">
	<td align="center" width="300px" style="font-size:32px;" >个人信息td>
	<td align="center" width="700px" style="font-size:32px;">管理的班级td>
    tr>
    
    <tr height="500px">
    <td valign="top">
    <table>
    
    <tr>
     <td>
        <table width=100% height="24px">table> 
     td>
    <td>
    td>
    tr>
    
    
    <tr height="50px">
	    <td width="100px" style="font-size:20px;">  名:td>
	   <td width="180px" style="font-size:20px;">${counInfo.name }td>
    tr>
    <tr height="50px">
	    <td style="font-size:20px;">  话:td>
	    <td style="font-size:20px;">${counInfo.phone }td>
    tr>
    <tr height="50px">
	    <td style="font-size:20px;">  箱:td>
	    <td style="font-size:20px;">${counInfo.email }td>
    tr>
    <tr height="50px">
	    <td style="font-size:20px;">办公室:td>
	    <td style="font-size:20px;">${counInfo.office }td>
    tr>
        <tr>
     <td>
        <table width=100% height="12px">table> 
     td>
    <td>
    td>
    tr>
    
    <tr>
    <td>
   <table width=100% height="1px" border="1px">table> 
    td>
    <td>
   <table width=100% height="1px" border="1px">table> 
    td>
    tr>

    <tr height="50px">
	    <td style="font-size:20px;">用户操作:td>
	    <td>
	    
	    <a href="javascript:doPost('QueryCounInfoServlet', {
      'id':'${counInfo.id }'})"> a>
    td>
    tr>
        <tr height="50px">
	    <td>td>
	    <td>
	     <a href="javascript:doPost('ModifyPasswordServlet', {
      'id':'${counInfo.id }'})"> a>
	   
	    
	  <%--   
	    <a href="QueryCounInfoServlet?id=${counInfo.id }"> a>
	    <a href="QueryAllStudentServlet?id=${counInfo.id }"> a>
	     --%>
	    td>
    tr>
    
           <tr>
     <td>
        <table width=100% height="12px">table> 
     td>
    <td>
    td>
    tr>
        <tr>
    <td>
   <table width=100% height="1px" border="1px">table> 
    td>
    <td>
   <table width=100% height="1px" border="1px">table> 
    td>
    tr>
    
            <tr height="50px">
	    <td style="font-size:20px;">  询:td>
	    <td>
	     <a href="javascript:doPost('QueryAllStudentServlet', {
      'id':'${counInfo.id }'})"> a>
	    td>
    tr>
    
    <tr height="50px">
	    <td>td>
	    <td>
	    
	    td>
    tr>
    
    
    table>
    td>
	<td valign="top">
	<c:if test="${fn:length(list) <= 0}"> 
	<table border="1px" style="border-collapse:collapse">
	<tr>
	<td width="700px" style="height: 50px;text-align: center;font-size:24px;">您还没有管理的班级,请添加!td>
	tr>
				table>
			c:if>
			<c:if test="${fn:length(list) > 0}">  
	<table border="1px" style="border-collapse:collapse">
	<tr>
					<td align="center" width="500px" style="height: 50px;font-size: 24px;">班级 td>
					<td align="center" width="200px" style="font-size: 24px;">操作td>
	tr>
	
	<tr>
				  <c:forEach items="${list}" var="coun">
				  <tr align="center">
					<td width="500px" style="height: 50px; font-size: 20px;">${coun.coclass}td>
					<td width="200px">
					<a href="javascript:doPost('QueryStuInfoServlet', {
      'stclass':'${coun.coclass}'})"><input style="font-size: 20px;height:40px; width: 75px;background: #D0DFEF;color:#0E59A9;" type="button" value="查看">a>
					  
					
	    			
	    			<input type="button" style="font-size: 20px;height:40px; width: 75px;background: #D0DFEF;color:#0E59A9;" value="删除" onclick="deleteclass('${coun.coclass}','${counInfo.id}')">
	    			
					td>
				  tr>
			  c:forEach>
	
	tr>
  
	table>
	       c:if>
	td>
	  <tr>
	<td height="50px" align="center" style="font-size: 20px">添加班级:td>
	<td height="50px" align="center">
	
	<a href="javascript:doPost('AddClassServlet', {
      'id':'${counInfo.id}','name':'${counInfo.name }'})"><input  id='c'  style="font-size: 18px;height:40px; width: 150px;background: #D0DFEF;color:#0E59A9;" style='background:#D0DFEF' onMouseOver='ChangeColorc()' onMouseout='RevertColorc()' type="button" value="添加管理班级">a>
	<%-- 
	<a href="AddClassServlet?id=${counInfo.id }&name=${counInfo.name }"> <input  id='c'  style="font-size: 18px;height:40px; width: 150px;background: #D0DFEF;color:#0E59A9;" style='background:#D0DFEF' onMouseOver='ChangeColorc()' onMouseout='RevertColorc()' type="button" value="添加管理班级">a>
	 --%>
	
	td>
  tr>
    table>
body>
html>

edit.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
   <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
   <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
    

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>学生修改个人信息title>
<script type='text/javascript'>
 
 function ChangeColora()
 {
      
  document.getElementById('a').style.backgroundColor="#8396E7"
 }
 function RevertColora()
 {
      
  document.getElementById('a').style.backgroundColor="#D0DFEF"
 }
 function ChangeColorb()
 {
      
  document.getElementById('b').style.backgroundColor="#8396E7"
 }
 function RevertColorb()
 {
      
  document.getElementById('b').style.backgroundColor="#D0DFEF"
 }
 
script>



<style type="text/css">
 body 
{
      
	 background: #93defe; 
} 
style>
head>
<body>

<form method="post" action="UpdateServlet">
<br><br>
	<h3 align="center">请修改个人的信息h3>
  <table border="3" width="800" align="center">
    <tr height="50px">
	<td style="font-size:20px;" width="200px">学号td>
	<td width="600px"><input readonly="readonly" style="background:#93defe; font-size:20px;border: 0;height: 50px;width: 100%" type="text" name="id" value="${stuInfo.id }">td>
    tr>
  
  <tr height="50px">
	<td style="font-size:20px;">姓名td>
	<td><input style="background:#93defe;font-size:20px;border: 0;height: 50px;width: 100%" type="text" name="name" value="${stuInfo.name }">td>
  tr>
  
  <tr height="50px">
	<td style="font-size:20px;">班级td>
	<td>
		<select name="stclass" style="background:#93defe; border: 0;height: 50px;width: 100%;font-size: 20px">
		<option value="${stuInfo.stclass }" style="bdisplay:none">${stuInfo.stclass }option>
	  	<c:forEach items="${list }" var="list">
			<option value="${list.idclass }">${list.idclass }option>
		c:forEach>
		select>
	td>
  tr>
  
  <tr height="50px">
	<td style="font-size:20px;">性别td>
	<td>
		<select name="gender" style="background:#93defe;border: 0;height: 50px;width: 100%;font-size: 20px">
			<option value="${stuInfo.gender}" style="background:#93defe;display:none">${stuInfo.gender}option>
			<option value="">option>
			<option value="">option>
		select>
	td>
  tr>
  
  <tr height="50px">
	<td style="font-size:20px;">电话td>
	<td><input style="background:#93defe;font-size:20px;border: 0;height: 50px;width: 100%" type="text" name="phone" value="${stuInfo.phone }">td>
  tr>
  
 	<tr height="50px">
		<td style="font-size:20px;">家庭住址td>
		<td><input style="background:#93defe;font-size:20px;border: 0;height: 50px;width: 100%" type="text" name="address" value="${stuInfo.address }">td>
	tr>
  
	<tr height="50px">
<td style="font-size:20px;">邮箱td>
		<td><input style="background:#93defe;font-size:20px;border: 0;height: 50px;width: 100%" type="text" name="email" value="${stuInfo.email }">td>
	tr>
  <tr height="50px">
	<td style="font-size:20px;">出生日期td>
	<td><input  style="background:#93defe;font-size:20px;border: 0;height: 50px;width: 100%" type="text" name="birthday"  value="${stuInfo.birthday }">td>
  tr>
  <tr height="50px">
	<td style="font-size:20px;">政治面貌td>
		<td>
				<select name="identity" style="background:#93defe;border: 0;height: 50px;width: 100%;font-size: 20px">
				  <option value="${stuInfo.identity }" style="background:#93defe;display:none">${stuInfo.identity }option>
				  <option value="团员">团员option>
				  <option value="党员">党员option>
				  <option value="群众">群众option>
				select>
	td>
  tr>
  <tr height="50px">
	<td style="font-size:20px;">寝室号td>
	<td><input style="background:#93defe;font-size:20px;border: 0;height: 50px;width: 100%" type="text" name="dormitory" value="${stuInfo.dormitory }">td>
  tr>
  <tr height="50px">
	<td colspan="2" align="center">
	  
	    
	<a href="javascript:history.back(-1)"> a>
	td>
  tr>
  table>
   form>
body>
html>

register.jsp

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>注册title>

<link href="css/register.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery-1.11.3.js">script>
<script type="text/javascript">



function ChangeColora()
{
      
 document.getElementById('a').style.backgroundColor="#00B3CA"
}
function RevertColora()
{
      
 document.getElementById('a').style.backgroundColor="#003561"
}
function ChangeColorb()
{
      
 document.getElementById('b').style.backgroundColor="#00B3CA"
}
function RevertColorb()
{
      
 document.getElementById('b').style.backgroundColor="#003561"
}




	/**
	 脚本区  1.写onFocus焦点存在 onBlur离开  用到onblur事件
	 */
	$(document).ready(function() {
      
		$("input[type=text]").blur(function() {
      
			switch (this.name) {
      
			case "password":
			var password= /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,16}$/;
				if(!(password.test(this.value)))  {
      
				$("#class_password").css("border","1px solid red");
				$("#password").html("请输入6-16位的密码,必须由数字和英文字母组成!");
				}
				break;
 			default:
				break; 
			}
		}).focus(function() {
      
			switch (this.name) {
      
			case "password":
				$("#class_password").css("border","3px solid #E3E6F3");
				$("#password").html("");
				break;
			default:
				break;
			}

		});		

	});
script>

<style type="text/css">
 body 
{
      
	 background-image:url('images/registerbackground.jpg'); 
} 
style>

head>

<body>
	<div class="login_box">
		<div class="login_name">
			<p>欢迎注册p>
		div>
		<form action="RegisteredServlet" method="post">
				用户类型:<select name="user_types">
				  <option value="0" style="display:none">选择用户类型option>
				  <option value="学生">学生option>
				  <option value="辅导员">辅导员option>
				select><br>
			学号/工号:<input 
				name="userid" type="text" id="class_userid"/> <span id="userid">span><br>    码:<input
				name="password" type="text" id="class_password"/> <span id="password">span><br>    名:<input 
			   name="name" type="text" id="class_name"/><span id="name">span><br>
			   
			   
			   <input id='a' type='submit' value='确认' style="width: 100%;" style='background:#003561' onMouseOver='ChangeColora()' onMouseout='RevertColora()'>
				<br><br>
				<a href="JumpIndexServlet"><input id='b' type='button' value='取消' style="width: 100%;" style='background:#003561' onMouseOver='ChangeColorb()' onMouseout='RevertColorb()'>a>
			
				
		form>
	div>
body>
html>

list_stu.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
     <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
 <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>查看班级学生信息列表title>
<style type="text/css">
 body 
{
      
	 background:#EBEDEF; 
} 
style>




<script type="text/javascript">

function doPost(to, p) {
       // to:提交动作(action),p:参数  
	var myForm = document.createElement("form");
	myForm.method = "post";
	myForm.action = to;
	for ( var i in p) {
      
		var myInput = document.createElement("input");
		myInput.setAttribute("name", i); // 为input对象设置name  
		myInput.setAttribute("value", p[i]); // 为input对象设置value  
		myForm.appendChild(myInput);
	}
	document.body.appendChild(myForm);
	myForm.submit();
	document.body.removeChild(myForm); // 提交后移除创建的form  
}



function doDelete(id) {
      
	/* 如果这里弹出的对话框,用户点击的是确定,就马上去请求Servlet。 
	如何知道用户点击的是确定。
	如何在js的方法中请求servlet。 */
	var flag = confirm("是否确定删除?");
	if(flag){
      
		location.href="DeleteStuInfoServlet?id="+id;
	}
}


script>

head>
<body>


<form action="SearchStudentServlet" method="post">
	<c:if test="${empty stclass}"> 
<input type="text" style="display:none" name="idclass" value="${idclass}">
	c:if>
	<c:if test="${not empty stclass}">  
<input type="text" style="display:none" name="idclass" value="${stclass}">
	
	c:if>


<table align="center" border="3" width="95%">
			<tr height="65px" align="center" >
				<td colspan="11" style="height: 50px">
				     
					输入学号查询:<input style="background-color:#F0F4F9;font-size:18px; height: 28px" type="text" name="stid"/>
					 
					输入姓名查询:<input style="background-color:#F0F4F9;font-size:18px; height: 28px" type="text" name="stname"/>
					 
					按性别查询:<select style="background-color:#F0F4F9;font-size:18px; height: 38px" name="stgender">
								<option value="">--请选择--
								<option value=""><option value="">select>
					   
					按政治面貌查询:<select style="background-color:#F0F4F9;font-size:18px; height: 38px" name="identity">
								<option value="">--请选择--
								<option value="团员">团员
								<option value="党员">党员
								<option value="群众">群众
							  select>
					   
					<input type="submit" style="font-size: 18px;height:38px; width:120px;background: #D0DFEF;color:#0E59A9;" value="点击查询">
					            
					         
			<c:if test="${empty stclass}"> 
				<a href="javascript:doPost('JumpAddStudentInfoServlet', {
      'stclass':'${idclass}'})"><input style="font-size: 18px;height:38px; width: 75px;background: #D0DFEF;color:#0E59A9;" type="button" value="添加">a>
			c:if>
			<c:if test="${not empty stclass}">  
			
				<a href="javascript:doPost('JumpAddStudentInfoServlet', {
      'stclass':'${stclass}'})"><input style="font-size: 18px;height:38px; width: 75px;background: #D0DFEF;color:#0E59A9;" type="button" value="添加">a>
	       c:if>
					         

			<c:if test="${empty stclass}">
				<a href="javascript:doPost('QueryCounClass', {
      'stclass':'${idclass}'})"><input style="font-size: 18px;height:38px; width: 120px;background: #D0DFEF;color:#0E59A9;" type="button" value="返回主页">a>
			c:if>
			<c:if test="${not empty stclass}">  
				<a href="javascript:doPost('QueryCounClass', {
      'stclass':'${stclass}'})"><input style="font-size: 18px;height:38px; width: 120px;background: #D0DFEF;color:#0E59A9;" type="button" value="返回主页">a>
	       c:if>
			tr>
<tr align="center" >
			<td height="45px">学号td>
			<td>姓名td>
			<td>性别td>
			<td>班级td>
			<td>电话号码td>
			<td>家庭住址td>
			<td>电子邮箱td>
			<td>出生日期td>
			<td>政治面貌td>
			<td>寝室号td>
			<td>操作td>
		  tr>
		  
	<c:if test="${fn:length(list) <= 0}"> 
	<table align="center" width="95%" border="2px" style="border-collapse:collapse">
	<tr align="center">
	<td   style="color:red; height: 50px;text-align: center; font-size:24px;">查询结果为空!!!td>
	tr>
				table>
			c:if>
		  
		  
	<c:if test="${fn:length(list) > 0}">
			  <c:forEach items="${list}" var="stu">
				  <tr align="center">
					<td height="45px">${stu.id }td>
					<td>${stu.name }td>
					<td>${stu.gender }td>
					<td>${stu.stclass }td>
					<td>${stu.phone }td>
					<td>${stu.address }td>
					<td>${stu.email }td>
					<td>${stu.birthday }td>
					<td>${stu.identity }td>
					<td>${stu.dormitory }td>
					
					<td><a href="javascript:doPost('QueryStuIdInfoServlet', {
      'id':'${stu.id }'})">更新a>   <a href="#" onclick="doDelete(${stu.id})">删除a>td>
				  tr>
			  c:forEach>

	
c:if>
table>

form>


body>
html>

list_Coun_Search.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
     <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
 <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>查询学生信息列表title>
<style type="text/css">
 body 
{
      
	 background:#EBEDEF; 
} 
style>

<script type="text/javascript">
function doDelete(id) {
      
	/* 如果这里弹出的对话框,用户点击的是确定,就马上去请求Servlet。 
	如何知道用户点击的是确定。
	如何在js的方法中请求servlet。 */
	var flag = confirm("是否确定删除?");
	if(flag){
      
		//表明点了确定。 访问servlet。 在当前标签页上打开 超链接,
		//window.location.href="DeleteServlet?sid="+sid;
		location.href="DeleteStuInfoServlet?id="+id;
	}
}
script>
head>
<body>
<form action="SearchCounServlet" method="post">
<input type="text" style="display:none" name="id" value="${id}">
<table align="center" border="3" width="95%">
			<tr height="65px" align="center" >
				<td colspan="11" style="height: 50px">
				      
					输入学号查询: <input style="background-color:#F0F4F9;font-size:18px; height: 28px" type="text" name="stid"/>
					  
					输入姓名查询: <input style="background-color:#F0F4F9;font-size:18px; height: 28px" type="text" name="stname"/>
					    
					<input type="submit" style="font-size: 18px;height:38px; width: 68px;background: #D0DFEF;color:#0E59A9;" value="查询">
					      
				<a href="javascript:history.back(-1)"><input style="font-size: 18px;height:38px; width: 68px;background: #D0DFEF;color:#0E59A9;" type="button" value="返回">a>
			tr>
<tr align="center" >
			<td height="45px">学号td>
			<td>姓名td>
			<td>性别td>
			<td>班级td>
			<td>电话号码td>
			<td>家庭住址td>
			<td>电子邮箱td>
			<td>出生日期td>
			<td>政治面貌td>
			<td>寝室号td>
		  tr>
	<c:if test="${fn:length(list) <= 0}"> 
		<table align="center" width="95%" border="2px" style="border-collapse:collapse">
			<tr align="center">
			  <td   style="color:red; height: 50px;text-align: center; font-size:24px;">没有查询到该信息!!!td>
			tr>
		table>
	c:if>
	<c:if test="${fn:length(list) > 0}">
			  <c:forEach items="${list}" var="stu">
				  <tr align="center">
					<td height="45px">${stu.id }td>
					<td>${stu.name }td>
					<td>${stu.gender }td>
					<td>${stu.stclass }td>
					<td>${stu.phone }td>
					<td>${stu.address }td>
					<td>${stu.email }td>
					<td>${stu.birthday }td>
					<td>${stu.identity }td>
					<td>${stu.dormitory }td>
				  tr>
			  c:forEach>
    c:if>
table>
form>
body>
html>

editlist.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
   <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
   <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
    

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>学生修改页面title>
<script type='text/javascript'>
	function ChangeColora()
	{
      
	 document.getElementById('a').style.backgroundColor="#8396E7"
	}
	function RevertColora()
	{
      
	 document.getElementById('a').style.backgroundColor="#D0DFEF"
	}
	function ChangeColorb()
	{
      
	 document.getElementById('b').style.backgroundColor="#8396E7"
	}
	function RevertColorb()
	{
      
	 document.getElementById('b').style.backgroundColor="#D0DFEF"
	}
script>
<style type="text/css">
 body 
{
      
	 background:#EBEDEF; 
} 
style>

head>
<body>
<br><br>
<h3 align="center">请修改学生信息h3>
<form method="post" action="UpdateStudentInfoServlet">
<input type="text"  style="display:none" name="idclass" value="${stclass }">
  <table border="3" width="800" align="center">
    <tr height="50px">
	 <td style="font-size:20px;" width="200px">学号td>
	 <td width="600px"><input readonly="readonly" style="background-color:#EBEDEF;font-size:20px; border: 0;height: 50px;width: 100%;" type="text" name="id" value="${stuInfo.id }">td>
  tr>
  <tr height="50px">
	<td style="font-size:20px;">姓名td>
	<td><input style="background-color:#EBEDEF;font-size:20px; border: 0;height: 50px;width: 100%;" type="text" name="name" value="${stuInfo.name }">td>
  tr>
  <tr height="50px">
	<td style="font-size:20px;">班级td>
	<td>
		<select name="stclass" style="background-color:#EBEDEF;font-size:20px; border: 0;height: 50px;width: 100%;">
		<option value="${stuInfo.stclass }" style="display:none">${stuInfo.stclass }option>
	  		<c:forEach items="${list }" var="list">
		<option value="${list.idclass }">${list.idclass }option>
			 c:forEach>
		select>
	td>
  tr>
  <tr height="50px">
	<td style="font-size:20px;">性别td>
	<td>
		<select name="gender" style="background-color:#EBEDEF;font-size:20px; border: 0;height: 50px;width: 100%;">
		<option value="${stuInfo.gender}" style="display:none">${stuInfo.gender}option>
		<option value="">option>
		<option value="">option>
		select>
	td>
  tr>
  
  <tr height="50px">
	<td style="font-size:20px;">电话td>
	<td><input style="background-color:#EBEDEF;font-size:20px; border: 0;height: 50px;width: 100%;" type="text" name="phone" value="${stuInfo.phone }">td>
  tr>
  <tr height="50px">
	<td style="font-size:20px;">家庭住址td>
	<td><input style="background-color:#EBEDEF;font-size:20px; border: 0;height: 50px;width: 100%;" type="text" name="address" value="${stuInfo.address }">td>
  tr>
	<tr height="50px">
	<td style="font-size:20px;">邮箱td>
	<td><input style="background-color:#EBEDEF;font-size:20px; border: 0;height: 50px;width: 100%;" type="text" name="email" value="${stuInfo.email }">td>
  tr>
  <tr height="50px">
	<td style="font-size:20px;">出生日期td>
	<td><input  style="background-color:#EBEDEF;font-size:20px; border: 0;height: 50px;width: 100%;" type="text" name="birthday"  value="${stuInfo.birthday }">td>
  tr>
  <tr height="50px">
	<td style="font-size:20px;">政治面貌td>
		<td>
				<select name="identity" style="background-color:#EBEDEF;font-size:20px; border: 0;height: 50px;width: 100%;">
				  <option value="${stuInfo.identity }" style="display:none">${stuInfo.identity }option>
				  <option value="团员">团员option>
				  <option value="党员">党员option>
				  <option value="群众">群众option>
				select>
	td>
  tr>
  <tr height="50px">
	<td style="font-size:20px;">寝室号td>
	<td><input style="background-color:#EBEDEF;font-size:20px; border: 0;height: 50px;width: 100%;" type="text" name="dormitory" value="${stuInfo.dormitory }">td>
  tr>
  <tr height="55px">
	<td colspan="2" align="center"> 
	
	             
	<a href="javascript:history.back(-1)"> a>
	td>
  tr>
  table>
   form>
body>
html>

源代码下载地址:https://download.csdn.net/download/qq_40529129/12741094

4、工具

1、eclipse
2、MYSQL
3、Tomcat
4、jar包:c3p0、dbutils、jstl、MYSQL驱动包(记得去修改MYSQL的密码,没见过的花一个10分钟去百度补补很简单
学生信息管理系统/辅导员信息管理系统_第12张图片

5、设计报告

密 级 公 开

设计报告
辅导员信息管理系统
XXX
(XXXXXX)
指导教师姓名:
职 称: 讲 师
单 位: 计算机与信息学院
专业名称: 软件工程
报告提交日期: 2020年03 月 10 日
报告答辩日期: 2020 年 月 日

答辩委员会主席:
报 告 评 阅 人:
年 月 日
辅导员信息管理系统
XXX
(xxxxx)

摘要:高校辅导员对学生信息进行管理时经常需要大量的时间进行管理,管理效率并不理想,学生不能及时的更正过时信息。因此提高辅导员管理学生信息的效率,避免繁杂的信息修改和整理,浪费大量的工作时间。就需要一个行之有效的学生信息管理工具。促进辅导员能方便快捷的管理学生信息。随着科技飞快的发展和更新,计算机的工作效率已经成为引领时代的一种潮流,本文将对辅导员信息管理系统的设计和实现过程进行阐述。系统采用B/S架构,运用MVC模式和javaweb技术,在开发过程中使用到java编程语言,mysql5.7数据库以及eclipse等开发工具。系统主要实现了学生页面,辅导员管理页面,学生页面主要有查看个人信息,学生登录,编辑个人信息,学生注册,查看辅导员信息,辅导员管理页面主要有登录注册,修改个人信息,查看班级学生信息,对学生信息进行增、删、改、查操作,班级管理。本文主要针对辅导员信息管理系统的需求分析、软件功能、系统设计、开发过程等几个方面进行详细的阐述。
关键字:信息管理;辅导员;学生

Counselor information management system
Liang Ming
(16083051043)
(Qiannan nationality normal college computer and Information College, Duyun 558000, Guizhou)
Abstract :The student information management of university counselors often need to manage a lot of time, the efficiency of management is not ideal, students can’t timely correction of outdated information. Therefore improve the efficiency of information management students, avoid multifarious information modification, and finishing, waste a lot of work time. You need an effective student information management tools. To promote the counselor can fast and convenient information management students. With the development of science and technology swift and update, the working efficiency of the computer has become a leading a trend of The Times, this article will information management system design and implementation of the process of instructors. System adopts B/S structure, using the MVC pattern and javaweb technology, used in the development process to the Java programming language, mysql5.7 database and development tools, such as eclipse. System mainly implements the students page, imperfect management page, students are mainly to check the personal information page, the student login, edit the personal information, student registration, information counselor, counselor management mainly include login, registration page to modify personal information, view the class information, to the student information to add, delete, change, check operation, class management. This article mainly aims at the counselor information management system of requirement analysis, software functions, system design, development process and so on several aspects in detail elaborated.
Keywords: Information management; counselor; students

目录
第一章 绪 论 5
1.1课题背景和开发意义 5
1.2开发工具与使用技术介绍 5
1.2.1 java语言简介 5
1.2.2 j2EE技术简介 5
1.2.3 Servlet技术简介 5
1.2.4 Jsp技术简介 5
1.2.5 eclipse开发工具 6
1.2.6 MySQL数据库简介 6
1.3进度安排 6
第二章 需求分析 7
2.1系统运行环境分析 7
2.2可行性分析 7
2.3功能需求分析 7
2.4用例图 7
2.4.1辅导员用户用例图 7
2.4.2学生用户用例图 8
2.5实体-联系图(E-R图) 8
2.6数据流图 9
2.6.1 辅导员用户顶层数据流图 9
2.6.2学生用户顶层数据流图 9
第三章 系统总体设计 10
3.1 项目概述 10
3.2总体设计 10
3.2.1主要功能 10
3.2.2 系统总体结构图 10
3.2.3系统功能模块图 10
3.3主界面设计 11
3.3.1辅导用户员主界面 11
3.3.2学生用户主界面 12
3.4 数据库设计 12
第四章 系统详细设计 15
4.1登录注册页面实现 15
4.1.1登录界面实现 15
4.1.2注册界面实现 15
4.2辅导员用户的主要页面实现 16
4.2.1辅导员用户主页面 16
4…2.2学生信息管理页面 17
4.3学生用户的主要页面实现 18
4.3.1学生用户主页面 18
4.3.2学生修改个人信息页面 19
4.4项目总览 19
第五章 总结 21
参考文献: 22

第一章 绪 论

1.1课题背景和开发意义
对高校辅导员工作的研究发现,一个高校辅导员需要对多个班级的学生信息进行管理,学生数量庞大,信息量大且不易整理,容易出现混乱。辅导员经常需要大量的时间进行管理,管理效率并不理想,学生不能及时的更新过时信息。因此需要一个能提高辅导员工作的信息管理工具。解放辅导员在管理学生信息方面的工作时间,让学生能实时的更新个人的信息避免错误的信息录入。从而提高学生和辅导员双方掌握实时信息的准确性。对此需要一个专业的平台来解决这部分问题。传统的辅导员对学生信息的管理包括收集、整理、管理面对的学生人数众多数据量庞大,不利于辅导员工作的开展。信息收集进度缓慢,整理又需要大量的时间成本,后期还需要对学生信息变化的实时更新给辅导员对学生信息的管理带来更多困难。Java作为当前的编程主流语言,它的安全性得到广大开发人员的一致认可,使用java开发一个辅导员信息管理系统,更加的安全,高效。
1.2开发工具与使用技术介绍
1.2.1 java语言简介
java是一门面向对象高级编程语言,应用多个领域、web开发,大数据分析,GUI界面的开发等。Java语言具有功能强大和简单易用两个特征。Java语言作为静态面向对象编程语言的代表,极好的体现了其面向对象理论,允许程序员、开发人员、业余爱好者以合理的思维方式进行复杂的编程,各种编程模式的应用,使得编程更加规范,更容易去扩展。
1.2.2 j2EE技术简介
J2EE技术它是java开发中的一项必要的技术,它是众多程序界大佬的经验累积的结果,能够很明显的改进和提高企业级开发的效率。具有很多优点:跨平台,多用户等优点,最重要的是安全的标准企业级平台,简化程序员的开发步骤。它是现有的非常完整的一个开发标准。
1.2.3 Servlet技术简介
Servlet在服务器端运行,动态地解析成为Web页面。Java Servlet具有高效率,使用起来简单方便,人们可以通过Servlet,写出更加高效的代码。 对于Servlet来说,重复的请求不会导致同一程序的多次转载,它是依靠线程的方式来支持并发访问的这是同其他技术相比它具有的优势。Servlet的九大内置对象使我们学习和使用的工具,学习使用它们使我们的学习目标。
1.2.4 Jsp技术简介
jsp的构成由java代码加上html代码这俩部分合起来的网站编程。程序的逻辑代码、数据的连接代码主要用java语言来实现,而前台用户看到的页面都是通过浏览器解析后代码,主要html代码,html主要用来显示页面,它还有一个别名,被人们称为java服务器页面,它的特点在于它能极好的将java代码和HTML代码连接起来,并能够很好的编译运行,具有java所具有的优点。
1.2.5 eclipse开发工具
一个开发工具能被很好的应用,在于这个使用者对快捷方式的记忆和深刻的理解其开发的原理和目的。Eclipse能够被广大开发者认可在于其能够不断的更新版本,能够免费的为使用者开放,为其提供了许多的刚入门的开发用户。我们想要扩展其功能只需下载相应的插件包就行了,能够做到即插即用,这样就避免了我们为其装载无用的插件,这样提高了程序员对插件的理解,更加深了程序员对程序的应用,还能节省服务器的内存消耗。
1.2.6 MySQL数据库简介
由于其体积小、速度快、总体拥有成本低,尤其是开放源码这一特点, MySQL是一个多用户、多线程的关系型数据库管理系统。 工作模式是基于客户机/服务器结构。目前它可以支持几乎所有的操作系统。MySql是一个开放的、快速的、多线程的、多用户的SQL数据库服务器。
1.3进度安排

第二章 需求分析

2.1系统运行环境分析
(1)开发环境:Window10
(2) 运行环境:Jdk、Jre
(3) 开发工具:Eclipse
2.2可行性分析
辅导员信息管理系统的开发应用的都是现代市场较为流行的技术,技术上完全满足辅导员信息管理系统功能的开发要求 。JAVA语言就是现代较为广泛的开发语言,编程工具eclipse是高效的高级开发工具可以节省大量的编程时间,使开发周期可以剪短。MySQL是一个多用户、多线程的关系型数据库管理系统足够支持辅导员与学生用户的使用。辅导员信息管理系统可以充分的利用计算机的便捷来实现辅导员对学生信息的高效管理,辅助辅导员的管理工作。
2.3功能需求分析
1、 辅导员对学生信息进行管理操作,即增、删、改、查操作。
2、 辅导员对班级为单位的学生信息进行管理。
3、 辅导员对自己的管理班级进行添加、删除操作。
4、 辅导员创建新的管理班级。
5、 辅导员修改个人信息。
6、 学生登录查看自己相关信息。
7、 学生修改个人相关信息。
8、 学生查看辅导员相关信息。
2.4用例图
2.4.1辅导员用户用例图
学生信息管理系统/辅导员信息管理系统_第13张图片

图2-1辅导员用例图
Figure 2-1 Instructors use case diagram
用例描述:辅导员用户可以进行注册后登录。登录成功可以修改密码,班级管理可以添加管理班级、删除管理班级、新建班级。对个人信息进行管理。查看管理的全部学生信息列表对其可以进行按条件查询。学生信息管理中可以对学生信息进行添加、删除、修改、查询操作。
2.4.2学生用户用例图
学生信息管理系统/辅导员信息管理系统_第14张图片

图2-2学生用例图
Figure 2-2 Students use case diagram
用例描述:学生用户可以注册和登录。如果学生信息由辅导员添加学生不需要注册即可输入学号和默认密码登录。登录成功可修改登录密码,查看个人信息、修改个人信息,查看辅导员信息。
2.5实体-联系图(E-R图)
辅导员信息管理系统E-R图如下:
学生信息管理系统/辅导员信息管理系统_第15张图片

图2-3 辅导员信息管理系统实体联系图
Figure 2-3 Entity relationship diagrams counselor information management system
2.6数据流图
数据流程图(DFD)是一种图形化的系统模型,它在一张图中展示信息系统的主要需求,即:输入、输出、过程和数据存储。描述数据流动、存储、处理的逻辑关系。 数据流程图(DFD)是一种图形化的系统模型,它在一张图中展示信息系统的主要需求,即:输入、输出、过程和数据存储。它描述了数据流动、存储、处理的逻辑关系。顶层数据流图可以直观的表述出辅导员用户和学生用户在使用该用户时数据的流向和处理过程。
2.6.1 辅导员用户顶层数据流图
学生信息管理系统/辅导员信息管理系统_第16张图片

图2-4 辅导员用户顶层数据流图
Figure 2-4 Counselor user top level data flow diagrams

2.6.2学生用户顶层数据流图

图2-5 学生用户顶层数据流图
Figure 2-5 Student users top level data flow diagrams

第三章 系统总体设计

3.1 项目概述
名称为“辅导员信息管理系统”。做一个能让辅导员对学生信息进行页面管理的系统。信息管理包括对学生信息的添加、修改、查询、和删除操作。辅导员对班级的管理包括添加管理班级、新建班级、删除管理班级、查看管理班级学生列表。学生用户主要功能为登录查看自己相关信息可以对个人信息进行修改操作。
3.2总体设计
3.2.1主要功能
辅导员用户模块:辅导员登录,注册,主要实现学生信息管理、班级管理。学生信息管理包括对学生信息的增加、删除、修改、查询。班级管理操作有添加管理班级、新建管理班级、以班级为单位的班级学生管理。
学生用户模块:学生登录,注册,查看自己相关的信息,修改自己的信息。
3.2.2 系统总体结构图
学生信息管理系统/辅导员信息管理系统_第17张图片

图3-1系统总体结构图
Figure 3-1 System overall structure

3.2.3系统功能模块图
辅导员信息管理系统分为两大功能模块,通过这两个模块之间的关系和约束,通过不同模块进行注册和登录,辅导员用户模块可以进行登录、注册、班级管理、修改个人信息、修改密码、学生信息管理。其中班级管理有两个小模块添加管理班级和新建班级,学生信息管理包括添加学生信息、修改学生信息、删除学生信息、查询学生信息。学生用户模块包括学生注册、登录、查看个人信息、修改个人信息、修改密码、查看辅导员信息。可以根据用户的区别进入到不同用户的操作内容如3-2所示:
学生信息管理系统/辅导员信息管理系统_第18张图片

图3-2系统功能模块图
Figure 3-2 System function module chart
3.3主界面设计
辅导员信息管理系统有两种用户即辅导员用户和学生用户不同用户的功能并不相同,该系统根据不同用户的需求和功能设计了两种用户的主界面。
3.3.1辅导用户员主界面
辅导员用户登录成功即可进入辅导员主界面,可以进行个人信息修改、修改登录密码、查看全体学生信息、查看班级学生信息、添加管理班级的操作如题3-2所示:
学生信息管理系统/辅导员信息管理系统_第19张图片

图3-3 辅导员主界面设计
Figure 3-3 Counselor main interface design
3.3.2学生用户主界面
学生用户登录成功即可来到学生信息主页面,该页面学生可以查看个人信息、修改个人信息、修改密码和查看辅导员信息。如图3-4所示:
学生信息管理系统/辅导员信息管理系统_第20张图片

图3-4 学生主界面设计
Figure 3-4 Students main interface design
3.4 数据库设计
辅导员信息管理系统:一共有6张表:在数据中实体、实体之间的关系的前提下,能形成的表和表之间的关系。本系统数据库采用mysql,接下来对表结构进行介绍。
(1)辅导员用户表:包含字段有辅导员账户、密码、辅导员姓名。辅导员用户注册成功后数据保存在该表中,表中数据提供用户登录验证。
表3-1辅导员用户表(counselor_user)
Table 3-1 Counselor user table(counselor_user)
列名 数据类型 长度 备注
coid varchar 255 账户
copassword varchar 255 密码
coname varchar 255 姓名

(2)辅导员班级表:辅导员班级表包含字段辅导员账户、辅导员姓名、辅导员管理班级。该表用于保存辅导员添加管理班级的信息。
表3-2辅导员班级表(counselor_class)
Table 3-2 Counselor class table(counselor_class)
列名 数据类型 长度 备注
coid varchar 255 账户名
name varchar 255 姓名
coclass varchar 255 管理班级

(3)辅导员信息表:辅导员信息表包含字段有辅导员账号、姓名、电话、邮箱、办公室。该表主要用于学生查看辅导员信息。
表3-3 辅导员信息表(counselor_info)
Table 3-3 Counselor information table(counselor_info)
列名 数据类型 长度 备注
id varchar 255 账户名
name varchar 255 姓名
phone varchar 255 电话号码
email varchar 255 邮箱
office varchar 255 办公室号

(4)班级表:班级表中存储班级名称信息。用于辅导员添加管理班级列表,辅导员创建新的班级。提供学生选择添加班级列表。
表3-4 班级表(scclass)
Table 3-4 Class table(scclass)
列名 数据类型 长度 备注
stclass varchar 255 学生班级
idclass varchar 255 班级
coclass varchar 255 辅导员班级

(5)学生用户表:包含字段有学生账户、密码、姓名。学生用户注册成功后数据保存在该表中,表中数据提供用户登录验证。
表3-5 学生用户表(student_user)
Table 3-5 Student user table(student_user)
列名 数据类型 长度 备注
stid varchar 255 账户
stpassword varchar 255 密码
stname varchar 255 姓名

(6)学生信息表:表中的数据是辅导员进行信息学生管理的数据来源也是数据更新存储的表。学生信息表包含字段有学生账号、姓名、性别、班级、电话、家庭地址、邮箱、出生日期、政治面貌、寝室号。该表主要用于学生查看个人信息,保存学生修改后的个人信息,保存辅导员添加学生信息、更新辅导员删除学生信息、辅导员查询学生信息,保存辅导员修改后的学生信息。

表3-6 学生信息表(student_info)
Table 3-6 Student information table(student_info)
列名 数据类型 长度 备注
id varchar 255 学生用户名
name varchar 255 姓名
gender varchar 255 电话号码
stclass varchar 255 邮箱
phone varchar 255 办公室号
address varchar 255 家庭地址
email varchar 255 邮箱
birthday varchar 255 出生日期
identity varchar 255 政治面貌
dormitory varchar 255 寝室号

第四章 系统详细设计

4.1登录注册页面实现
4.1.1登录界面实现
登录界面主要实现用户的登录功能,主要功能是进行登录和跳转到注册界面,用户可以根据自己的身份选择用户类型进行登录操作。用户登录时登录数据放在form表单中提交到servlet中查询数据库进行登录信息验证。后台的数据处理包括对用户名的验证,如账号是否存在,密码是否正确,是否选择了用户类型。出现错误会给用户相应的错误提示。
学生信息管理系统/辅导员信息管理系统_第21张图片

图4-1 登录页面
Figure 4-1 Login page
核心代码:
String stpassword = stuUser.getStpassword();
if (password.equals(stpassword)) {request.setAttribute(“id”,id);
request.getRequestDispatcher(“StuPageServlet”).forward(request, response);
}else{request.getRequestDispatcher(“promptHTML/prompt_stpassword.html”).forward(request, response);
}
String stpassword = counUser.getCopassword();
if (password.equals(stpassword)) {request.setAttribute(“id”, id);
request.getRequestDispatcher(“CounPageServlet”).forward(request, response);
}else { request.getRequestDispatcher(“promptHTML/prompt_stpassword.html”).forward(request, response);}
4.1.2注册界面实现
注册页面主要功能就是实现新用户的注册操作,对注册用户数据的规范约束和数据提交到数据库保存的功能。用户需要选择身份类型,输入学号/工号、密码、姓名进行注册。用户需要填写完整的注册信息才可以注册,对密码的规范要求如需要输入数字与英文字母的组合必须大于等于6个字符。如果注册过程信息不完整或账户重复都要给用户相应的提示信息。确保注册用户信息的完整性。
学生信息管理系统/辅导员信息管理系统_第22张图片

图4-2 注册页面
Figure 4-2 Registered page
核心代码:
StuService service = new StuServiceImpl();
List list = service.repeat();
for (StuUser stuUser : list) {
if(stuUser.getStid().equals(userid)) { request.getRequestDispatcher(“promptHTML/user_repeat.html”).forward(request, response);
StuInfo stuInfo = new StuInfo(userid, name);
service.addstuinfo(stuInfo);
StuUser stuUser = new StuUser(userid, password, name);
int i = service.stregistered(stuUser);
if(i>0) { request.getRequestDispatcher(“promptHTML/skip_index.html”).forward(request, response);
}else {response.getWriter().write(“注册失败!”);}
4.2辅导员用户的主要页面实现
4.2.1辅导员用户主页面
辅导员用户主页实现辅导员对学生的班级管理可查看管理班级的列表,这是一个jsp页面数据由后端从数据库中查询提供,进入可以查看班级学生信息列表,可以添加管理班级,个人信息更新,修改密码,查看全体管理的学生信息列表。个人信息可以给管理班级的学生查看。进行个人信息修改和班级管理的操作后页面将及时更新操作完成后的信息到该页面中。
学生信息管理系统/辅导员信息管理系统_第23张图片

图 4-3辅导员用户主页面
Figure 4-3 Counselor user home page
核心代码:
String id = (String) request.getAttribute(“id”);
CounService service = new CounServiceImpl();
CounInfo counInfo = service.queryCounInfo(id);
request.setAttribute(“counInfo”, counInfo);
List list = service.queryCounClass(id);
request.setAttribute(“list”, list);
request.getRequestDispatcher(“counIndex.jsp”).forward(request, response);
4…2.2学生信息管理页面
学生信息管理页面是辅导员对学生信息进行管理操作的页面,显示学生信息的内容有学号、姓名、性别、班级、电话号码、家庭住址、电子邮箱、政治面貌、出生日期、寝室号。 功能包括对学生信息的添加、修改、删除、查询的操作,查询包括条件查询。该页面以班级为单位,显示出班级全体学生信息,辅导员可以在该班级中进行信息管理的各项操作,操作完成提交请求后及时更新数据库的信息到该页面中。
学生信息管理系统/辅导员信息管理系统_第24张图片

图 4-4 学生信息管理页面
Figure 4-4 Student information management page
核心代码:
String stclass = request.getParameter(“stclass”);
request.setAttribute(“stclass”, stclass);
StuService service = new StuServiceImpl();
List list = service.queryListStuInfo(stclass);
request.setAttribute(“list”, list);
request.getRequestDispatcher(“list_stu.jsp”).forward(request, response);
4.3学生用户的主要页面实现
4.3.1学生用户主页面
学生登录成功即可查看个人的信息,信息数据由后台查询数据库而来,用户在该页面中可以查看个人信息、编辑个人信息、修改登录密码、查看辅导员信息等操作。
学生信息管理系统/辅导员信息管理系统_第25张图片

图 4-5 学生用户主页面
Figure 4-5 Student user home page
核心代码:
String id = (String) request.getAttribute(“id”);
StuService service = new StuServiceImpl();
StuInfo stuInfo = service.queryStuInfo(id);
request.setAttribute(“stuInfo”, stuInfo);
request.getRequestDispatcher(“list_page.jsp”).forward(request, response);
4.3.2学生修改个人信息页面
学生用户到该页面进行信息修改,显示旧信息便于更新,将信息更新完成即可提交保存。
学生信息管理系统/辅导员信息管理系统_第26张图片

图 4-6 学生信息修改页面
Figure 4-6 Student information modify page
核心代码:
request.setAttribute(“id”, id);
StuInfo stuInfo = new StuInfo(id,name, gender, stclass, phone, address, email, birthday, identity,dormitory);
StuService service = new StuServiceImpl();
service.updateStu(stuInfo);
request.getRequestDispatcher(“StuPageServlet”).forward(request, response);
4.4项目总览
辅导员信息管理系统的具体开发框架为MVC框架。在MVC模式中,三个层各施其职,所以如果一旦哪一层的需求发生了变化,就只需要更改相应的层中的代码而不会影响到其它层中的代码。MVC模式中,由于按层把系统分开,有利于组件的重用。如控制层可独立成一个能用的组件,视图层也可做成通用的操作界面提高代码的修改和维护难度。三层结构:web层、service层、dao层,web层负责前端展示和用户请求的处理。数据访问层也即dao层,重点负责数据库访问,service是层业务逻辑层实现核心业务逻辑,事务控制。项目中dao包存放创建需要实现的接口,daoimpl包中存放实现dao包的接口和方法的类,实现的方是对数据库进行各项具体操作的方法。用于具体的页面请求调用。Servlet包中的类负责页面接收页面请求和响应。
学生信息管理系统/辅导员信息管理系统_第27张图片

图 4-7 项目目录
Figure 4-7 Project directory

第五章 总结

认真回想一下辅导员信息管理系统从开始设计到后来完成设计的过程中,我付出了我的很多的时间。常常在网上,或图书馆里查阅相关的数据以及书籍,对它们进行整理归纳,形成设计思路。从毕业设计的选题、毕业设计到毕业论文完成,长达半年的时间里,使我对系统开发的整个流程有了更深刻的认识,对所学专业的基本理论、专业知识和技术进行了简单梳理,并有了更深入的学习,让我明悟了许多道理比如实践才能出真知,起初以为毕业设计很简单,当我真正的了解java时,发现好多知识都需要真正的尝试才有可能写出高效率的代码。通过不断的实验,与调试最终完成系统的设计。
这个系统的完成检验了我大学所学知识的整合和知识的应用,学的很多知识都是点,而做一个系统需要的是所有知识点的融会贯通,当然还需要不断的学习新的知识,遇到不能解决的问题时,需要用拓展知识面的态度来面对问题,来学习新知识。辅导员信息管理系统的完成能解决高校辅导员进行学生信息管理时带来的不便,让辅导员高效的管理学生信息。该系统的使用能方便学生和老师的生活就是我最大的收获。
当然本设计并不是十分完美的,由于时间关系,在部分功能中还存在着一些不足和弊端,虽然这些毛病可能不会影响整体功能的运行,但是本设计还在一步步的完善中,争取提前的发现问题、解决问题、完善设计,降低失误。

参考文献:
[1] 王岩. Java语言程序设计[M]. 北京: 清华大学出版社, 2015.
[2] 温恺.肖少拥. Java 语言程序设计教程[M]. 杭州: 浙江大学出版社, 2013.
[3]面向对象的软件工程[M]. 清华大学出版社 , (美)BerndBruegge,(美)AllenH.Dutoit著, 2002
[4]黄文娟. 基于Java和MySQL的图书馆信息化管理系统设计[J]. 电子设计工程,2019,27(02):20-24.
[5]谈java平台下的MVC框架[J]. 郭晓龙,纪鑫. 才智. 2009.
[6]软件设计模式及其在Java类库中的典型实现[J]. 饶一梅,王治宝,王秀峰. 计算机工程与应用. 2002(04)
[7]陶国荣.《Jquery权威指南》.机械工业出版社,2011.
[8]李强.《Javascript权威指南》.机械工业出版社,2007.
[9]陈俊伟. 高职学院《Java程序设计》课程翻转课堂教学设计探讨[J]. 电脑迷,2019(01):103.
[10]夏曦,李洪,贾香恩,谢涵风,杨颖. 基于Java Web的“大学印迹”网站的设计与实现[J]. 电脑知识与技术,2018,14(23):120-122.
[11] 马定争,薛益鸽. 基于SQL Server与JAVA平台的机票预定系统[J]. 智能计算机与应用,2018,8(03):214-219. 
[12] 桂林斌. 基于Java EE的高校科研成果管理系统的设计与实现[J]. 电脑与电信,2018(Z1):24-27.
  [13 ]蔡创. “互联网+”背景下《Java程序设计》课程混合式教学改革研究[J]. 软件工程,2018,21(12):
  [14丁慧. 基于游戏项目二维分解的教学改革——以Java教学为例. 科学大众(科学教育) [J],2019.
  [15] 乐勇. 计算机软件开发的JAVA编程语言与实际应用分析[J]. 电子质量,2018(08).
[16]禹程. 基于Java语言的人力资源信息系统研究. 电子设计工程[J],2019.
指导教师:XXX 讲师

你可能感兴趣的:(学生信息管理系统,辅导员信息管理系统,课程设计)