JSP学籍信息管理系统实现增删改查的相关功能操作

JSP学籍信息管理系统

前言

这是我大二上学期那年学习JSP做的实训项目,现在把它贴在网上供自己和需要的人进行回顾和参考,如有哪里做的不规范还请指出,因为这是第一次做的项目所以不是特别完善,界面也不够美观,简单的实现了相关功能,该项目使用的软件是myeclipse2014,数据库为mysql,实现了学籍信息管理系统中相关的增删改查操作能够运行实现,以及验证码等功能,如有不够规范,还敬请谅解!


一、学籍信息管理项目实训要求

学籍信息管理模块
1、管理员表,学生表,学籍信息表(学校,专业,班级,学历,总学分,入学年月,毕业年月);
2、学生表:注册,登录,查询自己的信息,修改密码和个人信息,用户只能修改和查看自己的学籍信息。
3、管理员表:查看所有人信息,对所有人信息以及学籍信息进行增删改。

二、数据库设计

1.创建数据库

数据库代码如下(示例):

create database DB_StudentstatusInfo_xxd

use DB_StudentstatusInfo_xxd

--创建超级管理员(后缀名xxd为本人的缩写名)
create table T_SupAdmin_xxd(
supid_xxd bigint primary key identity(10,1),
supname_xxd varchar(200) not null,
suppwd_xxd varchar(200) not null)


--创建管理员表
create table T_Admin_xxd(
Aid_xxd bigint primary key identity(1000,1),
useName_xxd varchar(200) not null,
pwd_xxd varchar(200) not null
)


--创建学生表
create table T_Student_xxd(
Sid_xxd bigint primary key identity(10000,1),
Sname_xxd varchar(200) not null,
Spwd_xxd varchar(200) not null,
Sgender_xxd varchar(4) not null,
Sbrith_xxd date not null,
Stell_xxd varchar(300) not null,
Saddress_xxd varchar(300) not null,
Squestion_xxd varchar(300) not null,
Sanswer_xxd varchar(200) not null,
Snote_xxd text)


--创建学籍表
create table T_Studentstatus_xxd(
Xid_xxd bigint primary key identity(100,1),
Xid1_xxd bigint not null,
Xschool_xxd varchar(300) not null,
Xspecial_xxd varchar(300) not null,
Xclass_xxd varchar(300) not null,
Xeducation_xxd varchar(300) not null,
Xtotalcredit_xxd varchar(300) not null,
Xschoolyear_xxd date not null,
Xgraduation_xxd date )


insert into T_SupAdmin_xxd values('胡图图','1')

--建立主外键关系(学生表与学籍表)
alter table T_Studentstatus_xxd
add constraint FK_T_Studentstatus_xxd_T_Student_xxd_Xid1_xxd
foreign key(Xid1_xxd) references T_Student_xxd(Sid_xxd)

三.实现代码

附上github源码及数据库地址:https://github.com/xxd6772123/xxd6772123.github.io

1.创建学籍管理系统的web工程

工程创建类包如图所示:工程整体类包
添加配置
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

①首先开始写entity层:

com.xxd.
分别创建好管理员类、学生类、学籍信息类、以及超级管理员类(超级管理员可有可无,我是在要求之上添加到,但你也可以根据自己的要求进行添加与否)

1.创建超级管理员类

package com.xxd.entity;

public class SupAdmin_xxd {
	long supid_xxd;
	String supname_xxd;
	String suppwd_xxd;
	public long getSupid_xxd() {
		return supid_xxd;
	}
	public void setSupid_xxd(long supid_xxd) {
		this.supid_xxd = supid_xxd;
	}
	public String getSupname_xxd() {
		return supname_xxd;
	}
	public void setSupname_xxd(String supname_xxd) {
		this.supname_xxd = supname_xxd;
	}
	public String getSuppwd_xxd() {
		return suppwd_xxd;
	}
	public void setSuppwd_xxd(String suppwd_xxd) {
		this.suppwd_xxd = suppwd_xxd;
	}
	public SupAdmin_xxd(long supid_xxd, String supname_xxd, String suppwd_xxd) {
		this.supid_xxd = supid_xxd;
		this.supname_xxd = supname_xxd;
		this.suppwd_xxd = suppwd_xxd;
	}
	public SupAdmin_xxd(String supname_xxd, String suppwd_xxd) {
		this.supname_xxd = supname_xxd;
		this.suppwd_xxd = suppwd_xxd;
	}
	public SupAdmin_xxd() {
	}

}

2.创建管理员类

package com.xxd.entity;

public class Admin_xxd {
	long Aid_xxd;
	String useName_xxd;
	String pwd_xxd;
	public long getAid_xxd() {
		return Aid_xxd;
	}
	public void setAid_xxd(long aid_xxd) {
		Aid_xxd = aid_xxd;
	}
	public String getUseName_xxd() {
		return useName_xxd;
	}
	public void setUseName_xxd(String useName_xxd) {
		this.useName_xxd = useName_xxd;
	}
	public String getPwd_xxd() {
		return pwd_xxd;
	}
	public void setPwd_xxd(String pwd_xxd) {
		this.pwd_xxd = pwd_xxd;
	}
	public Admin_xxd(long aid_xxd, String useName_xxd, String pwd_xxd) {
		super();
		Aid_xxd = aid_xxd;
		this.useName_xxd = useName_xxd;
		this.pwd_xxd = pwd_xxd;
	}
	public Admin_xxd(String useName_xxd, String pwd_xxd) {
		super();
		this.useName_xxd = useName_xxd;
		this.pwd_xxd = pwd_xxd;
	}
	public Admin_xxd() {
		super();
	}
	
}

3.创建学生类

package com.xxd.entity;

public class Student_xxd {
	long Sid_xxd;
	String Sname_xxd;
	String Spwd_xxd;
	String Sgender_xxd;
	String Sbrith_xxd;
	String Stell_xxd;
	String Saddress_xxd;
	String Squestion_xxd;
	String Sanswer_xxd;
	String Snote_xxd;
	public long getSid_xxd() {
		return Sid_xxd;
	}
	public void setSid_xxd(long sid_xxd) {
		Sid_xxd = sid_xxd;
	}
	
	public String getSname_xxd() {
		return Sname_xxd;
	}
	public void setSname_xxd(String sname_xxd) {
		Sname_xxd = sname_xxd;
	}
	public String getSpwd_xxd() {
		return Spwd_xxd;
	}
	public void setSpwd_xxd(String spwd_xxd) {
		Spwd_xxd = spwd_xxd;
	}
	public String getSgender_xxd() {
		return Sgender_xxd;
	}
	public void setSgender_xxd(String sgender_xxd) {
		Sgender_xxd = sgender_xxd;
	}
	public String getSbrith_xxd() {
		return Sbrith_xxd;
	}
	public void setSbrith_xxd(String sbrith_xxd) {
		Sbrith_xxd = sbrith_xxd;
	}
	public String getStell_xxd() {
		return Stell_xxd;
	}
	public void setStell_xxd(String stell_xxd) {
		Stell_xxd = stell_xxd;
	}
	public String getSaddress_xxd() {
		return Saddress_xxd;
	}
	public void setSaddress_xxd(String saddress_xxd) {
		Saddress_xxd = saddress_xxd;
	}
	public String getSquestion_xxd() {
		return Squestion_xxd;
	}
	public void setSquestion_xxd(String squestion_xxd) {
		Squestion_xxd = squestion_xxd;
	}
	public String getSanswer_xxd() {
		return Sanswer_xxd;
	}
	public void setSanswer_xxd(String sanswer_xxd) {
		Sanswer_xxd = sanswer_xxd;
	}
	public String getSnote_xxd() {
		return Snote_xxd;
	}
	public void setSnote_xxd(String snote_xxd) {
		Snote_xxd = snote_xxd;
	}
	public Student_xxd(long sid_xxd,String sname_xxd, String spwd_xxd,
			String sgender_xxd, String sbrith_xxd, String stell_xxd,
			String saddress_xxd, String squestion_xxd, String sanswer_xxd,
			String snote_xxd) {
		super();
		Sid_xxd = sid_xxd;
		Sname_xxd = sname_xxd;
		Spwd_xxd = spwd_xxd;
		Sgender_xxd = sgender_xxd;
		Sbrith_xxd = sbrith_xxd;
		Stell_xxd = stell_xxd;
		Saddress_xxd = saddress_xxd;
		Squestion_xxd = squestion_xxd;
		Sanswer_xxd = sanswer_xxd;
		Snote_xxd = snote_xxd;
	}

	public Student_xxd(String sname_xxd, String spwd_xxd,
			String sgender_xxd, String sbrith_xxd, String stell_xxd,
			String saddress_xxd, String squestion_xxd, String sanswer_xxd,
			String snote_xxd) {
		super();
		
		Sname_xxd = sname_xxd;
		Spwd_xxd = spwd_xxd;
		Sgender_xxd = sgender_xxd;
		Sbrith_xxd = sbrith_xxd;
		Stell_xxd = stell_xxd;
		Saddress_xxd = saddress_xxd;
		Squestion_xxd = squestion_xxd;
		Sanswer_xxd = sanswer_xxd;
		Snote_xxd = snote_xxd;
	}
	public Student_xxd() {
		super();
	}
	
}

4.创建学籍信息类

package com.xxd.entity;

public class StudentStatus_xxd {
	long Xid_xxd;
	long Xid1_xxd;
	String Xschool_xxd;
	String Xspecial_xxd;
	String Xclass_xxd;
	String Xeducation_xxd;
	String Xtotalcredit_xxd;
	String Xschoolyear_xxd;
	String Xgraduation_xxd;
	public long getXid_xxd() {
		return Xid_xxd;
	}
	public void setXid_xxd(long xid_xxd) {
		Xid_xxd = xid_xxd;
	}
	public long getXid1_xxd() {
		return Xid1_xxd;
	}
	public void setXid1_xxd(long xid1_xxd) {
		Xid1_xxd = xid1_xxd;
	}
	public String getXschool_xxd() {
		return Xschool_xxd;
	}
	public void setXschool_xxd(String xschool_xxd) {
		Xschool_xxd = xschool_xxd;
	}
	public String getXspecial_xxd() {
		return Xspecial_xxd;
	}
	public void setXspecial_xxd(String xspecial_xxd) {
		Xspecial_xxd = xspecial_xxd;
	}
	public String getXclass_xxd() {
		return Xclass_xxd;
	}
	public void setXclass_xxd(String xclass_xxd) {
		Xclass_xxd = xclass_xxd;
	}
	public String getXeducation_xxd() {
		return Xeducation_xxd;
	}
	public void setXeducation_xxd(String xeducation_xxd) {
		Xeducation_xxd = xeducation_xxd;
	}
	public String getXtotalcredit_xxd() {
		return Xtotalcredit_xxd;
	}
	public void setXtotalcredit_xxd(String xtotalcredit_xxd) {
		Xtotalcredit_xxd = xtotalcredit_xxd;
	}
	public String getXschoolyear_xxd() {
		return Xschoolyear_xxd;
	}
	public void setXschoolyear_xxd(String xschoolyear_xxd) {
		Xschoolyear_xxd = xschoolyear_xxd;
	}
	public String getXgraduation_xxd() {
		return Xgraduation_xxd;
	}
	public void setXgraduation_xxd(String xgraduation_xxd) {
		Xgraduation_xxd = xgraduation_xxd;
	}
	public StudentStatus_xxd(long xid_xxd,long xid1_xxd,String xschool_xxd,
			String xspecial_xxd, String xclass_xxd, String xeducation_xxd,
			String xtotalcredit_xxd, String xschoolyear_xxd,
			String xgraduation_xxd) {
		super();
		Xid_xxd = xid_xxd;
		Xid1_xxd = xid_xxd;
		Xschool_xxd = xschool_xxd;
		Xspecial_xxd = xspecial_xxd;
		Xclass_xxd = xclass_xxd;
		Xeducation_xxd = xeducation_xxd;
		Xtotalcredit_xxd = xtotalcredit_xxd;
		Xschoolyear_xxd = xschoolyear_xxd;
		Xgraduation_xxd = xgraduation_xxd;
	}
	
	public StudentStatus_xxd(long xid1_xxd, String xschool_xxd,
			String xspecial_xxd, String xclass_xxd, String xeducation_xxd,
			String xtotalcredit_xxd, String xschoolyear_xxd,
			String xgraduation_xxd) {
		super();
		Xid1_xxd = xid1_xxd;
		Xschool_xxd = xschool_xxd;
		Xspecial_xxd = xspecial_xxd;
		Xclass_xxd = xclass_xxd;
		Xeducation_xxd = xeducation_xxd;
		Xtotalcredit_xxd = xtotalcredit_xxd;
		Xschoolyear_xxd = xschoolyear_xxd;
		Xgraduation_xxd = xgraduation_xxd;
	}
	public StudentStatus_xxd() {
		super();
	}

}

②然后开始写dao层:
dao层分类
在Dao层分别创建四个Class对应每个类的方法接口


1.SupAdminDao层代码如下:

package com.xxd.Dao;

import java.util.List;

import com.xxd.entity.Admin_xxd;

public interface SupAdminDao_xxd {
	
	//验证超级管理员的账号和密码(超级管理员只能在数据库中插入)
	public int supUseNameandpwd(String supname_xxd, String suppwd_xxd);
	
	//遍历所有管理员的信息
	public List<Admin_xxd> queryAllAdminInfo();

}

2.AdminDao层代码如下:

package com.xxd.Dao;

import java.util.List;

import com.xxd.entity.Admin_xxd;

public interface AdminDao_xxd {
	
	//注册管理员
	public int insertAdmin_xxd(Admin_xxd a);
	
	//检测用户名是否存在
	public int checkuseNameIsExist(String useName_xxd);

	//验证用户名和密码是否正确
	public int UseNameandpwd(String useName_xxd, String pwd_xxd);
	
	//表格遍历所有管理员信息
	public List<Admin_xxd> queryAllAdminInfo();

	//超级管理员修改管理员信息
	public int updateAdminInfoBySup(Admin_xxd admin);
	
	//删除管理员
	public int delAdmin(long Aid_xxd);
	
	//通过管理员id查询所有学生信息
	List<Admin_xxd> queryStuByAid(long Aid_xxd);
}

3.StudentDao代码如下:

package com.xxd.Dao;

import java.util.List;

import com.xxd.entity.Student_xxd;



public interface StudentDao_xxd {
	
	//添加学生信息
	public int insertStudent_xxd(Student_xxd s);
	
	//验证用户名和密码
	public int queryStuBySnameAndSpwd(String Sname_xxd, String Spwd_xxd);
	
	//用户名找回密码
	public Student_xxd queryStuInfoByUserName(String Sname_xxd);
	
	//学生通过问题答案修改密码
	public int modifyPwdByUserNameAndQuestionAndAnswer(String Sname_xxd,String Squestion_xxd, String Sanswer_xxd);
	
	//通过登录后修改密码
	public int updatePwdBySname(String Sname_xxd, String Spwd_xxd);
	
	//通过学生id添加学籍
	public long checkstuId(String Sname_xxd);
	
	//所有学生信息表的修改
	public int updateStuInfoByStudent(Student_xxd student);

	//通过学号查询姓名
	String getSname(long Sid_xxd);
	
	
	//遍历所有学生信息
	public List<Student_xxd> queryAllStuInfo();
	
	//删除学生
	public int delstu(long Sid_xxd);

	//表格查询通过学生姓名查询到该生所有信息
	public List<Student_xxd> queryStuBySname(String Sname_xxd);

	//表格查询通过学生姓名查询到该生所有信息
	public List<Student_xxd> queryStuBySid(long Sid_xxd);
	
}

4.StudentstatusDao代码如下:

package com.xxd.Dao;

import com.xxd.entity.StudentStatus_xxd;

public interface StudentStatusDao_xxd {

	//添加学籍信息
	public int addStudentStatus(StudentStatus_xxd d);
	
	//删除学籍
	public int delsta(long Xid_xxd);
	
	//通过学号查询学籍号
	public long checkXid(long Xid1_xxd);
	
	//通过学号查询到对的学籍信息
	public StudentStatus_xxd queryStuStaInfoByXid(long Xid1_xxd);
	
	//修改学籍信息
	public int updateStuStaInfoByStudentSta(StudentStatus_xxd Studentstatus);
}

③其次是Util(工具)层的代码片段(类创建如图所示)
在这里插入图片描述


CEF.java代码如下所示:

package com.xxd.util;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebFilter;

@WebFilter(filterName="a",urlPatterns="/*")
public class CEF_xxd implements Filter{

	@Override
	public void destroy() {
		
	}

	@Override
	public void doFilter(ServletRequest req, ServletResponse resp,
			FilterChain chain) throws IOException, ServletException {
		req.setCharacterEncoding("utf-8");
		resp.setCharacterEncoding("utf-8");
		resp.setContentType("text/html;charset=utf-8");
		chain.doFilter(req, resp);
	}

	@Override
	public void init(FilterConfig arg0) throws ServletException {
		
	}

}

DBuilt.java代码如下所示:
注意:String url = “jdbc:sqlserver://127.0.0.1:1433;database=DB_StudentstatusInfo_xxd;user=sa;password=1234”;中的database、user、password都要根据个人设置情况进行修改!!!

package com.xxd.util;

import java.sql.Connection;
import java.sql.DriverManager;

import org.junit.Test;

public class DButil_xxd {
public static Connection conn = null;
	
	public static Connection getConn(){
		try{
			Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
			String url = "jdbc:sqlserver://127.0.0.1:1433;database=DB_StudentstatusInfo_xxd;user=sa;password=1234";
			conn = DriverManager.getConnection(url);
			if(conn != null) {
//				System.out.println("ok!!!!!!");
			}else{
				System.out.println("failed");
			}
		}catch(Exception e){
			e.printStackTrace();
		}
		return conn;
	}
	public void closeConn(Connection conn){
		if(conn != null){
			try{
				conn.close();
			}catch(Exception e){
				e.printStackTrace();
			}
		}
	}
	@Test
	public void test(){
		getConn();
	}
}

④再是写Daoimplement层(Dao实现层)
dao实现层
1.首先是SupAdminDaoImpl.java的代码(超级管理员实现类)

package com.xxd.DaoImpl;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;

import com.xxd.Dao.SupAdminDao_xxd;
import com.xxd.entity.Admin_xxd;
import com.xxd.entity.Student_xxd;
import com.xxd.util.DButil_xxd;

public class SupAdminDaompl_xxd implements SupAdminDao_xxd{
	//验证超级管理员用户名和密码
	public int supUseNameandpwd(String supname_xxd, String suppwd_xxd) {
		int x = 0 ;
		try{
			Connection conn = DButil_xxd.getConn();
			String checkSupUser_sql="select * from T_SupAdmin_xxd where supname_xxd=? and suppwd_xxd=?";
			PreparedStatement ps = conn.prepareStatement(checkSupUser_sql);
			ps.setString(1, supname_xxd);
			ps.setString(2, suppwd_xxd);
			ResultSet rs = ps.executeQuery();
			if(rs.next()){
				x=1;
			}
		}catch(Exception e){
			e.printStackTrace();
		}
		return x;
	}

	//查询所有管理员信息
	@Override
	public List<Admin_xxd> queryAllAdminInfo() {
		List<Admin_xxd> list = new ArrayList<Admin_xxd>();
		try{
			Connection conn = DButil_xxd.getConn();
			String query_adm="select * from T_Admin_xxd";
			Statement stmt = conn.createStatement();
			ResultSet rs = stmt.executeQuery(query_adm);
			while(rs.next()){
				Admin_xxd a = new Admin_xxd(rs.getLong(1),rs.getString(2),rs.getString(3));
				list.add(a);
			}
		}catch (Exception e){
			e.printStackTrace();
		}
		return list;
	}
}

2.其次是AdminDaoImpl.java代码(管理员实现类)

package com.xxd.DaoImpl;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;

import com.xxd.Dao.AdminDao_xxd;
import com.xxd.entity.Admin_xxd;
import com.xxd.entity.Student_xxd;
import com.xxd.util.DButil_xxd;

public class AdminDaoImpl_xxd implements AdminDao_xxd{
	//添加管理员
	public int insertAdmin_xxd(Admin_xxd a) {
		int x = 0;
		try{
//			System.out.println("insertAdmin");
			Connection conn = DButil_xxd.getConn();
			String insert_sql = "insert into T_Admin_xxd values(?,?)";
			PreparedStatement ps = conn.prepareStatement(insert_sql);
			ps.setString(1, a.getUseName_xxd());
			ps.setString(2, a.getPwd_xxd());
			x = ps.executeUpdate();
		}catch(Exception e){
			e.printStackTrace();
		}
		return x;
	}
	//通过管理员的用户名进行查询操作
	public List<Admin_xxd> queryStuByuseName(String useName_xxd) {
		List<Admin_xxd> list = new ArrayList<Admin_xxd>();
		try {
			Connection conn = DButil_xxd.getConn();
			String query_str = "select * from T_Admin_xxd where useName_xxd like '%'+?+'%'";
			PreparedStatement ps = conn.prepareStatement(query_str);
			ps.setString(1, useName_xxd);
			ResultSet rs = ps.executeQuery();
			while (rs.next()) {
				Admin_xxd a = new Admin_xxd(rs.getLong(1), useName_xxd,rs.getString(3));
				list.add(a);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return list;
	}
	//通过管理员id查询管理员信息
	@Override
	public List<Admin_xxd> queryStuByAid(long Aid_xxd) {
		List<Admin_xxd> list = new ArrayList<Admin_xxd>();
		try {
			Connection conn = DButil_xxd.getConn();
			String query_str = "select * from T_Admin_xxd where Aid_xxd=?";
			PreparedStatement ps = conn.prepareStatement(query_str);
			ps.setLong(1, Aid_xxd);
			ResultSet rs = ps.executeQuery();
			while (rs.next()) {
				Admin_xxd a = new Admin_xxd(Aid_xxd, rs.getString(2),rs.getString(3));
				list.add(a);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return list;
	}
	//进行修改管理员信息操作
	public int updateAdminInfoBySup(Admin_xxd admin) {
		int x = 0;
		try {
			Connection conn = DButil_xxd.getConn();
			String updateAdmin_sql = "update T_Admin_xxd set useName_xxd=?,pwd_xxd=? where Aid_xxd=?";
			Admin_xxd a = admin;
			PreparedStatement ps = conn.prepareStatement(updateAdmin_sql);
			ps.setString(1, a.getUseName_xxd());
			ps.setString(2, a.getPwd_xxd());
			ps.setLong(3, a.getAid_xxd());
			x = ps.executeUpdate();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return x;
	}

	//查看用户名是否存在
	@Override
	public int checkuseNameIsExist(String useName_xxd) {
		int x = 0 ;
		try{
//			System.out.println("checkusename");
			Connection conn = DButil_xxd.getConn();
			String checkName_sql="select count(*) from T_Admin_xxd where useName_xxd=?";
			PreparedStatement ps = conn.prepareStatement(checkName_sql);
			ps.setString(1, useName_xxd);
			ResultSet rs = ps.executeQuery();
//			System.out.println(useName_xxd+"----------------------");
			if(rs.next()){
				x=rs.getInt(1);
			}
		}catch(Exception e){
			e.printStackTrace();
		}
		return x;
	}
	
	//验证管理员的用户名和密码
	public int UseNameandpwd(String useName_xxd, String pwd_xxd) {
		int x = 0 ;
		try{
//			System.out.println("checkUserNameAndPwd");
			Connection conn = DButil_xxd.getConn();
			String checkUser_sql="select * from T_Admin_xxd where useName_xxd=? and pwd_xxd=?";
			PreparedStatement ps = conn.prepareStatement(checkUser_sql);
			ps.setString(1, useName_xxd);
			ps.setString(2, pwd_xxd);
			ResultSet rs = ps.executeQuery();
			if(rs.next()){
				x=1;
			}
		}catch(Exception e){
			e.printStackTrace();
		}
		return x;
	}


	//查询所有管理员信息
	@Override
	public List<Admin_xxd> queryAllAdminInfo() {
		List<Admin_xxd> list = new ArrayList<Admin_xxd>();
		try{
			Connection conn = DButil_xxd.getConn();
			String query_adm="select * from T_Admin_xxd";
			Statement stmt = conn.createStatement();
			ResultSet rs = stmt.executeQuery(query_adm);
			while(rs.next()){
				Admin_xxd a = new Admin_xxd(rs.getLong(1),rs.getString(2),rs.getString(3));
				list.add(a);
			}
		}catch (Exception e){
			e.printStackTrace();
		}
		return list;
	}


	//通过id删除管理员
	public int delAdmin(long Aid_xxd) {
		int x=0;
		try {
			Connection conn =DButil_xxd.getConn();
			String del_sql="delete from T_Admin_xxd where Aid_xxd=?";
			PreparedStatement ps =conn.prepareStatement(del_sql);
			ps.setLong(1, Aid_xxd);
			x=ps.executeUpdate();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return x;
	}
}


3.其次是studentDaoImpl.java(学生实现类)

package com.xxd.DaoImpl;



import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;

import com.xxd.Dao.StudentDao_xxd;
import com.xxd.entity.Student_xxd;
import com.xxd.util.DButil_xxd;

public class StudentDaoImpl_xxd implements StudentDao_xxd{
	//添加学生操作
	@Override
	public int insertStudent_xxd(Student_xxd s) {
		int x = 0;
		try{
//			System.out.println("insertuser");
			
			
			Connection conn = DButil_xxd.getConn();
			
		
			String insert_sql = "insert into T_Student_xxd values(?,?,?,?,?,?,?,?,?)";
			
		
			PreparedStatement ps = conn.prepareStatement(insert_sql);
		
			ps.setString(1, s.getSname_xxd());
			ps.setString(2, s.getSpwd_xxd());
			ps.setString(3, s.getSgender_xxd());
			ps.setString(4, s.getSbrith_xxd());
			ps.setString(5, s.getStell_xxd());
			ps.setString(6, s.getSaddress_xxd());
			ps.setString(7, s.getSquestion_xxd());
			ps.setString(8, s.getSanswer_xxd());
			ps.setString(9, s.getSnote_xxd());
			x = ps.executeUpdate();
		}catch(Exception e){
			e.printStackTrace();
		}
		return x;
	}

	 //通过学生Id删除学生操作
	public int delstu(long Sid_xxd) {
		int x=0;
		try {
			Connection conn =DButil_xxd.getConn();
			String del_sql="delete from T_Student_xxd where Sid_xxd=?";
			PreparedStatement ps =conn.prepareStatement(del_sql);
			ps.setLong(1, Sid_xxd);
			x=ps.executeUpdate();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return x;
	}
	
	//通过回答问题是否正确进行修改密码
	@Override
	public int modifyPwdByUserNameAndQuestionAndAnswer(String Sname_xxd,
			String Squestion_xxd, String Sanswer_xxd) {
		int x = 0;
		try{
			Connection conn = DButil_xxd.getConn();
			String check_sql="select * from T_Student_xxd where Sname_xxd=? and Squestion_xxd=? and Sanswer_xxd=?";
			PreparedStatement ps = conn.prepareStatement(check_sql);
			ps.setString(1, Sname_xxd);
			ps.setString(2, Squestion_xxd);
			ps.setString(3, Sanswer_xxd);
			ResultSet rs = ps.executeQuery();
			if(rs.next()){
				x=rs.getInt(1);
			}
		}catch(Exception e){
			e.printStackTrace();
		}
		return x;
	}

	
	//通过账号查看个人信息
	public Student_xxd queryStuInfoByUserName(String Sname_xxd) {
		Student_xxd s = null;
		try{
			Connection conn = DButil_xxd.getConn();
			String queryStu_sql = "select * from T_Student_xxd where Sname_xxd=?";
			PreparedStatement ps = conn.prepareStatement(queryStu_sql);
			ps.setString(1, Sname_xxd);
			ResultSet rs = ps.executeQuery();
			if(rs.next()){
				s = new Student_xxd(rs.getLong(1), Sname_xxd,rs.getString(3),rs.getString(4),
						rs.getString(5),rs.getString(6),rs.getString(7),rs.getString(8),rs.getString(9),rs.getString(10));
				
			}
		}catch(Exception e){
			e.printStackTrace();
		}
		return s;
	}
	
	//通过学生姓名进行查找学生
	@Override
	public List<Student_xxd> queryStuBySname(String Sname_xxd) {
		List<Student_xxd> list = new ArrayList<Student_xxd>();
		try {
			Connection conn = DButil_xxd.getConn();
			String query_str = "select * from T_Student_xxd where Sname_xxd like '%'+?+'%'";
			PreparedStatement ps = conn.prepareStatement(query_str);
			ps.setString(1, Sname_xxd);
			ResultSet rs = ps.executeQuery();
			while (rs.next()) {
				Student_xxd s = new Student_xxd(rs.getLong(1), Sname_xxd,rs.getString(3),rs.getString(4),
						rs.getString(5),rs.getString(6),rs.getString(7),rs.getString(8),rs.getString(9),rs.getString(10));
				list.add(s);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return list;
	}
	
	//通过学号查询学生
	public Student_xxd queryStuInfoBySid(long Sid_xxd) {
		Student_xxd s = null;
		try{
			Connection conn = DButil_xxd.getConn();
			String queryStu_sql = "select * from T_Student_xxd where Sid_xxd=?";
			PreparedStatement ps = conn.prepareStatement(queryStu_sql);
			ps.setLong(1, Sid_xxd);
			ResultSet rs = ps.executeQuery();
			if(rs.next()){
				s = new Student_xxd(Sid_xxd, rs.getString(2),rs.getString(3),rs.getString(4),
						rs.getString(5),rs.getString(6),rs.getString(7),rs.getString(8),rs.getString(9),rs.getString(10));
				
			}
		}catch(Exception e){
			e.printStackTrace();
		}
		return s;
	}

	//验证学生登录信息
	public int queryStuBySnameAndSpwd(String Sname_xxd, String Spwd_xxd) {
		int x = 0;
		try{
			Connection conn = DButil_xxd.getConn();
			if(conn != null){
				String stu_login = "select count(*) from T_Student_xxd where Sname_xxd=? and Spwd_xxd=?";
				PreparedStatement ps = conn.prepareStatement(stu_login);
				ps.setString(1, Sname_xxd);
				ps.setString(2, Spwd_xxd);
				ResultSet rs = ps.executeQuery();
				if(rs.next()){
					x = rs.getInt(1);
//					System.out.println("-----------找到登录匹配记录:" + x);
				}
				ps.close();
				conn.close();
			}
		}catch(Exception e){
			e.printStackTrace();
		}
		return x;
	}
	
	//修改学生账号的密码
	@Override
	public int updatePwdBySname(String Sname_xxd, String Spwd_xxd) {
		int x = 0;
		try {
			Connection conn = DButil_xxd.getConn();
			String update_sql = "update T_Student_xxd set Spwd_xxd =? where Sname_xxd=?";
			PreparedStatement ps = conn.prepareStatement(update_sql);
			ps.setString(1, Spwd_xxd);
			ps.setString(2, Sname_xxd);
			x = ps.executeUpdate();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return x;
	}
//	通过学号查询学生
	@Override
	public List<Student_xxd> queryStuBySid(long Sid_xxd) {
		List<Student_xxd> list = new ArrayList<Student_xxd>();
		try {
			Connection conn = DButil_xxd.getConn();
			String query_str = "select * from T_Student_xxd where Sid_xxd=?";
			PreparedStatement ps = conn.prepareStatement(query_str);
			ps.setLong(1, Sid_xxd);
			ResultSet rs = ps.executeQuery();
			while (rs.next()) {
				Student_xxd i = new Student_xxd(Sid_xxd, rs.getString(2),rs.getString(3),rs.getString(4),
						rs.getString(5),rs.getString(6),rs.getString(7),rs.getString(8),rs.getString(9),rs.getString(10));
				list.add(i);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return list;
	}


//	通过学生姓名查询到学号
	@Override
	public long checkstuId(String Sname_xxd) {
		long Sid_xxd = -1;
		try {
			Connection conn = DButil_xxd.getConn();
			String query_sql = "select Sid_xxd from T_Student_xxd  where Sname_xxd=?";
			PreparedStatement ps = conn.prepareStatement(query_sql);
			ps.setString(1, Sname_xxd);
			ResultSet rs=ps.executeQuery();
			if(rs.next()){
				Sid_xxd=rs.getLong(1);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Sid_xxd;
	}
	
//	通过学号获得学生姓名
	@Override
	public String getSname(long Sid_xxd) {
		String Sname_xxd=null;
		try {
			Connection conn=DButil_xxd.getConn();
//			System.out.println(id+" --------------");
			String query_sql="select Sname_xxd from T_Student_xxd where Sid_xxd=?";
			PreparedStatement ps = conn.prepareStatement(query_sql);
			ps.setLong(1, Sid_xxd);
			ResultSet rs = ps.executeQuery();
			if(rs.next()){
				Sname_xxd=rs.getString(1);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Sname_xxd;
	}

//		学生修改个人信息
	public int updateStuInfoByStudent(Student_xxd student) {
		int x = 0;
		try{
//			System.out.println("adminmodify---------------------");
			Connection conn = DButil_xxd.getConn();
			String updateStu_sql = "update T_Student_xxd set Spwd_xxd=?,Sgender_xxd=?,Sbrith_xxd=?,Stell_xxd=?,Saddress_xxd=?,Squestion_xxd=?,Sanswer_xxd=?,Snote_xxd=? where Sname_xxd=?";
			Student_xxd s = student;
			PreparedStatement ps = conn.prepareStatement(updateStu_sql);
			ps.setString(1, s.getSpwd_xxd());
			ps.setString(2, s.getSgender_xxd());
			ps.setString(3, s.getSbrith_xxd());
			ps.setString(4, s.getStell_xxd());
			ps.setString(5, s.getSaddress_xxd());
			ps.setString(6, s.getSquestion_xxd());
			ps.setString(7, s.getSanswer_xxd());
			ps.setString(8, s.getSnote_xxd());
			ps.setString(9, s.getSname_xxd());
			x = ps.executeUpdate();
		}catch(Exception e){
			e.printStackTrace();
		}
		return x;
	}


//	遍历所有学生信息
	@Override
	public List<Student_xxd> queryAllStuInfo() {
		List<Student_xxd> list = new ArrayList<Student_xxd>();
//		System.out.println("all-------------");
		try{
			Connection conn = DButil_xxd.getConn();
			String query_stu="select * from T_Student_xxd";
			Statement stmt = conn.createStatement();
			ResultSet rs = stmt.executeQuery(query_stu);
			while(rs.next()){
				Student_xxd s = new Student_xxd(rs.getLong(1),rs.getString(2),rs.getString(3),rs.getString(4),rs.getString(5),rs.getString(6),rs.getString(7),
						rs.getString(8),rs.getString(9),rs.getString(10));
				list.add(s);
			}
		}catch (Exception e){
			e.printStackTrace();
		}
		return list;
	}

}
	

4.再是studentstatusDaoImpl.java(学生学籍实现类)

package com.xxd.DaoImpl;

import java.sql.Connection;
import java.sql.PreparedStatement;



import java.sql.ResultSet;

import com.xxd.Dao.StudentStatusDao_xxd;
import com.xxd.entity.StudentStatus_xxd;
import com.xxd.entity.Student_xxd;
import com.xxd.util.DButil_xxd;

public class StudentStatusImpl_xxd implements StudentStatusDao_xxd{
	
	@Override
	//添加学籍信息
	public int addStudentStatus(StudentStatus_xxd d) {
		int x = 0;
		try {
			Connection conn = DButil_xxd.getConn();
			String insert_sql = "insert into T_Studentstatus_xxd values(?,?,?,?,?,?,?,?)";
			PreparedStatement ps = conn.prepareStatement(insert_sql);
			ps.setLong(1, d.getXid1_xxd());
			ps.setString(2, d.getXschool_xxd());
			ps.setString(3, d.getXspecial_xxd());
			ps.setString(4, d.getXclass_xxd());
			ps.setString(5, d.getXeducation_xxd());
			ps.setString(6, d.getXtotalcredit_xxd());
			ps.setString(7, d.getXschoolyear_xxd());
			ps.setString(8, d.getXgraduation_xxd());
			x = ps.executeUpdate();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return x;
	}
	//删除学籍信息
	public int delsta(long Xid_xxd) {
		int x=0;
		try {
			Connection conn =DButil_xxd.getConn();
			String del_sql="delete from T_Studentstatus_xxd where Xid_xxd=?";
			PreparedStatement ps =conn.prepareStatement(del_sql);
			ps.setLong(1, Xid_xxd);
			x=ps.executeUpdate();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return x;
	}
//	通过学号添加学籍信息
	public StudentStatus_xxd queryStuStaInfoByXid(long Xid1_xxd) {
		StudentStatus_xxd d = null;
//		System.out.println("-------querystustatus");
		try{
			Connection conn = DButil_xxd.getConn();
			String queryStu_sql = "select * from T_Studentstatus_xxd where Xid1_xxd=?";
			PreparedStatement ps = conn.prepareStatement(queryStu_sql);
			ps.setLong(1, Xid1_xxd);
			ResultSet rs = ps.executeQuery();
			if(rs.next()){
				d = new StudentStatus_xxd(rs.getLong(1),Xid1_xxd, rs.getString(3),rs.getString(4),rs.getString(5),
						rs.getString(6),rs.getString(7),rs.getString(8),rs.getString(9));
				
			}
		}catch(Exception e){
			e.printStackTrace();
		}
		return d;
	}
//	通过学号修改学籍信息
	public int updateStuStaInfoByStudentSta(StudentStatus_xxd Studentstatus) {
		int x = 0;
		try{
			Connection conn = DButil_xxd.getConn();
			String updateStuSta_sql = "update T_Studentstatus_xxd set Xschool_xxd=?,Xspecial_xxd=?,Xclass_xxd=?,Xeducation_xxd=?,Xtotalcredit_xxd=?,Xschoolyear_xxd=?,Xgraduation_xxd=? where Xid1_xxd=?";
			StudentStatus_xxd d = Studentstatus;
			PreparedStatement ps = conn.prepareStatement(updateStuSta_sql);
			ps.setString(1, d.getXschool_xxd());
			ps.setString(2, d.getXspecial_xxd());
			ps.setString(3, d.getXclass_xxd());
			ps.setString(4, d.getXeducation_xxd());
			ps.setString(5, d.getXtotalcredit_xxd());
			ps.setString(6, d.getXschoolyear_xxd());
			ps.setString(7, d.getXgraduation_xxd());
			ps.setLong(8, d.getXid1_xxd());
			x = ps.executeUpdate();
		}catch(Exception e){
			e.printStackTrace();
		}
		return x;
	}
	
//	通过学号检验学籍是否存在
	public long checkXid(long Xid1_xxd) {
			long Xid_xxd = -1;
			try{
				Connection conn = DButil_xxd.getConn();
				String query_sql = "select Xid_xxd from T_Studentstatus_xxd where Xid1_xxd=?";
				PreparedStatement ps = conn.prepareStatement(query_sql);
				ps.setLong(1, Xid1_xxd);;
				ResultSet rs = ps.executeQuery();
				if(rs.next()){
					Xid_xxd=rs.getLong(1);
				}
			}catch(Exception e){
				e.printStackTrace();
			}
		return Xid_xxd;
	}
}

⑤最后是servive层代码(创建j如图所示)
在这里插入图片描述
1.SupAdminServ.java(超级管理员服务类)

package com.xxd.Service;

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

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.xxd.Dao.SupAdminDao_xxd;
import com.xxd.DaoImpl.AdminDaoImpl_xxd;
import com.xxd.DaoImpl.StudentDaoImpl_xxd;
import com.xxd.DaoImpl.SupAdminDaompl_xxd;
import com.xxd.entity.Admin_xxd;
import com.xxd.entity.Student_xxd;


@WebServlet(name="SupAdminServ_xxd",urlPatterns="/SupAdminServ_xxd")
public class SupAdminServ_xxd extends HttpServlet{
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)throws ServletException, IOException 
	{
		doPost(req, resp);

	}
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		String str = req.getParameter("act");

		if ("login".equals(str)) {
			loginSupAdmin(req,resp);
			}else if("exist".equals(str)){
				existServ(req,resp);
			}

}
	private void existServ(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		req.getSession().invalidate();
		req.getRequestDispatcher("supAdmin_xxd.jsp").forward(req, resp);

	}
	//超级管理员验证登录
	private void loginSupAdmin(HttpServletRequest req, HttpServletResponse resp) 
			throws ServletException, IOException {
		PrintWriter out = resp.getWriter();
		String code_xxd = req.getParameter("code_xxd");
		String sbnumber_xxd = (String) req.getSession().getAttribute("sbnumber_xxd");
		if (!sbnumber_xxd.equalsIgnoreCase(code_xxd)) {
			out.print("<script>alert('验证码错误!');location.href='supAdmin_xxd.jsp'</script>");
			return;
		}
		String supname_xxd = req.getParameter("supname_xxd");
		String suppwd_xxd = req.getParameter("suppwd_xxd");
		int x = new SupAdminDaompl_xxd().supUseNameandpwd(supname_xxd, suppwd_xxd);
		if (x < 1) {
//			System.out.println("用户名或密码不正确!");
			out.print("<script>alert('登录失败,用户名或密码错误!');location.href='supAdmin_xxd.jsp'</script>");
			return;
		} else {
//			System.out.println("登录成功");
			HttpSession session = req.getSession();
			session.setAttribute("a", supname_xxd);
			req.getRequestDispatcher("supAdminlogin_xxd.jsp").forward(req, resp);
		}
		}
	}

2.AdminServ.java(管理员服务类)

package com.xxd.Service;

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

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.xxd.DaoImpl.AdminDaoImpl_xxd;
import com.xxd.DaoImpl.StudentDaoImpl_xxd;
import com.xxd.DaoImpl.StudentStatusImpl_xxd;
import com.xxd.entity.Admin_xxd;
import com.xxd.entity.StudentStatus_xxd;
import com.xxd.entity.Student_xxd;



@WebServlet(name="AdminService_xxd",urlPatterns="/AdminService_xxd")
public class AdminService_xxd extends HttpServlet{
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)throws ServletException, IOException 
	{
		doPost(req, resp);

	}
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		String str = req.getParameter("act");

		if ("reg".equals(str)) {
			regAdmin(req,resp);
			}else if ("login".equals(str)) {
				loginServ(req, resp);
			}else if ("checkAdmin".equals(str)) {
				checkAdminServ(req, resp);
			}else if ("addstu".equals(str)) {
				addstuServ(req, resp);
			}else if ("addstusta".equals(str)) {
				AdminaddStuStatusServ(req, resp);
			}else if ("AdminseleStaInfo".equals(str)) {
				AdminseleStaInfoServ(req, resp);
			}else if ("queryAllStuInfo".equals(str)) {
				queryAllStuInfoServ(req, resp);
			}else if ("AdminUpdateStaInfo".equals(str)) {
				AdminUpdateStaInfoServ(req, resp);
			}else if ("queryAlladminInfo".equals(str)) {
				queryAlladminInfoServ(req, resp);
			}else if ("delAdmin".equals(str)) {
				delAdminServ(req, resp);
			}else if ("exist".equals(str)) {
				existServ(req, resp);
			}else if ("modifyAdminInfo".equals(str)) {
				 modifyAdminInfoServ(req, resp);
			}else if ("ModifyAdminByAid".equals(str)) {
				ModifyAdminByAidServ(req, resp);
			}else if ("ModifyAdminByAname".equals(str)) {
				ModifyAdminByAnameServ(req, resp);
			}
	}
	private void existServ(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		req.getSession().invalidate();
		req.getRequestDispatcher("AdminMain_xxd.jsp").forward(req, resp);

	}
	private void ModifyAdminByAidServ(HttpServletRequest req,
			HttpServletResponse resp) throws ServletException, IOException {
		long Aid_xxd = Long.valueOf(req.getParameter("Aid_xxd"));
		List<Admin_xxd> list = new AdminDaoImpl_xxd().queryStuByAid(Aid_xxd);
		req.getSession().setAttribute("adminList", list);
		req.getRequestDispatcher("SupModifyAdmin_xxd.jsp").forward(req, resp);
	}
	private void ModifyAdminByAnameServ(HttpServletRequest req,
			HttpServletResponse resp) throws ServletException, IOException {
		String useName_xxd = req.getParameter("useName_xxd").trim();
		List<Admin_xxd> list = new AdminDaoImpl_xxd().queryStuByuseName(useName_xxd);
		req.getSession().setAttribute("adminList", list);
		req.getRequestDispatcher("SupModifyAdmin_xxd.jsp").forward(req, resp);
	}
	private void modifyAdminInfoServ(HttpServletRequest req,
			HttpServletResponse resp) throws ServletException, IOException {
		long Aid_xxd = Long.valueOf(req.getParameter("Aid_xxd"));
		String useName_xxd = req.getParameter("useName_xxd");
		String pwd_xxd = req.getParameter("pwd_xxd");
//		System.out.println(useName_xxd+"----------");
//		System.out.println(pwd_xxd);
		int x = new AdminDaoImpl_xxd().updateAdminInfoBySup((new Admin_xxd(Aid_xxd,useName_xxd, pwd_xxd)));
//		System.out.println("----------------"+x);
		PrintWriter out = resp.getWriter();
		if (x <= 0) {
			
			return;
		} else {
//			System.out.println("修改成功!");
			List<Admin_xxd> list = new AdminDaoImpl_xxd().queryAllAdminInfo();
			req.setAttribute("adminList", list);
			out.print("<script>alert('信息修改成功,请刷新!');location.href='SupModifyAdmin_xxd.jsp'</script>");
		}
	}
	private void AdminUpdateStaInfoServ(HttpServletRequest req,
			HttpServletResponse resp) throws ServletException, IOException {
		String Xschool_xxd = req.getParameter("Xschool_xxd");
		String Xspecial_xxd = req.getParameter("Xspecial_xxd");
		String Xclass_xxd = req.getParameter("Xclass_xxd");
		String Xeducation_xxd = req.getParameter("Xeducation_xxd");
		String Xtotalcredit_xxd = req.getParameter("Xtotalcredit_xxd");
		String Xschoolyear_xxd = req.getParameter("Xschoolyear_xxd");
		String Xgraduation_xxd = req.getParameter("Xgraduation_xxd");
		long  Xid1_xxd = Long.valueOf(req.getParameter("Xid1_xxd"));
		int x = new StudentStatusImpl_xxd().updateStuStaInfoByStudentSta(new StudentStatus_xxd(Xid1_xxd,Xschool_xxd,Xspecial_xxd,Xclass_xxd,
				Xeducation_xxd,Xtotalcredit_xxd,Xschoolyear_xxd,Xgraduation_xxd));
		PrintWriter out = resp.getWriter();
		System.out.println("x="+x+"----------------------");
		if (x <= 0) {
			out.print("<script>alert('学籍修改失败');location.href='AdminModifySta_xxd.jsp'</script>");
			return;
		} else {
			out.print("<script>alert('学籍修改成功');location.href='AdminModifyStu_xxd.jsp'</script>");
			return;
		}
	}
	private void delAdminServ(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		long Aid_xxd = Long.valueOf(req.getParameter("Aid_xxd"));
		// System.out.println("id="+ id+"   ------");
		int x = new AdminDaoImpl_xxd().delAdmin(Aid_xxd);
		PrintWriter out = resp.getWriter();
		if (x <= 0) {
			out.print("<script>alert('删除用户失败');location.href='supAdminlogin_xxd.jsp'</script>");
		} else {
			out.print("<script>alert('删除用户成功,请进行刷新页面!');location.href='SupModifyAdmin_xxd.jsp'</script>");
		}
	}
	private void queryAlladminInfoServ(HttpServletRequest req,
			HttpServletResponse resp) throws ServletException, IOException {
		List<Admin_xxd> list = new AdminDaoImpl_xxd().queryAllAdminInfo();
		HttpSession session = req.getSession();
		session.setAttribute("adminList", list);
		req.getRequestDispatcher("SupModifyAdmin_xxd.jsp").forward(req, resp);
	}
	private void queryAllStuInfoServ(HttpServletRequest req,
			HttpServletResponse resp) throws ServletException, IOException {
		List<Student_xxd> list = new StudentDaoImpl_xxd().queryAllStuInfo();
		req.getSession().setAttribute("studentList", list);
		req.getRequestDispatcher("AdminModifyStu_xxd.jsp").forward(req, resp);
	}
	private void AdminseleStaInfoServ(HttpServletRequest req,
			HttpServletResponse resp) throws ServletException, IOException{
	long Xid1_xxd = Long.valueOf(req.getParameter("id"));
	String Sname_xxd = new StudentDaoImpl_xxd().getSname(Xid1_xxd);
	StudentStatus_xxd sta = new StudentStatusImpl_xxd().queryStuStaInfoByXid(Xid1_xxd);
	PrintWriter out = resp.getWriter();
	if (sta == null) {
		out.print("<script>alert('该生学籍尚未填写,可直接删除当前信息!');location.href='AdminModifyStu_xxd.jsp'</script>");
		return;
	} else {
		HttpSession session = req.getSession();
		session.setAttribute("a",  Sname_xxd);
		req.setAttribute("sta", sta);
		req.getRequestDispatcher("AdminModifySta_xxd.jsp").forward(req, resp);
	}

}
	private void AdminaddStuStatusServ(HttpServletRequest req,
			HttpServletResponse resp) 
		throws ServletException, IOException {
		long  Xid1_xxd = Long.valueOf(req.getParameter("id"));
		String Xschool_xxd = req.getParameter("Xschool_xxd");
		String Xspecial_xxd = req.getParameter("Xspecial_xxd");
		String Xclass_xxd = req.getParameter("Xclass_xxd");
		String Xeducation_xxd = req.getParameter("Xeducation_xxd");
		String Xtotalcredit_xxd = req.getParameter("Xtotalcredit_xxd");
		String Xschoolyear_xxd = req.getParameter("Xschoolyear_xxd");
		String Xgraduation_xxd = req.getParameter("Xgraduation_xxd");
		int x = new StudentStatusImpl_xxd().addStudentStatus(new StudentStatus_xxd(Xid1_xxd, Xschoolyear_xxd, Xspecial_xxd, Xclass_xxd,
				Xeducation_xxd, Xtotalcredit_xxd, Xschoolyear_xxd, Xgraduation_xxd));
//		System.out.println(Xid1_xxd+"----------------------");
		PrintWriter out = resp.getWriter();
		if (x <= 0) {
			out.print("<script>alert('学籍添加失败');location.href='AdminAddStuStatus_xxd.jsp'</script>");
			return;
		} else {
			out.print("<script>alert('学籍添加成功');location.href='Adminlogin_xxd.jsp'</script>");
			return;
		}
	}
	private void addstuServ(HttpServletRequest req, HttpServletResponse resp) 
			throws ServletException, IOException{
		String Sname_xxd = req.getParameter("Sname_xxd");
		String Spwd_xxd = req.getParameter("Spwd_xxd");
		String Sgender_xxd = req.getParameter("Sgender_xxd");
		String Sbrith_xxd = req.getParameter("Sbrith_xxd");
		String Stell_xxd = req.getParameter("Stell_xxd");
		String Saddress_xxd = req.getParameter("Saddress_xxd");
		String Squestion_xxd = req.getParameter("Squestion_xxd");
		String Sanswer_xxd = req.getParameter("Sanswer_xxd");
		String Snote_xxd = req.getParameter("Snote_xxd");
		PrintWriter out = resp.getWriter();
		int x = new StudentDaoImpl_xxd().insertStudent_xxd(new Student_xxd(Sname_xxd,Spwd_xxd,Sgender_xxd,Sbrith_xxd,Stell_xxd,Saddress_xxd,Squestion_xxd,Sanswer_xxd,Snote_xxd));
//		System.out.println("!!"+Sname_xxd+"--"+Spwd_xxd+"~~"+Sgender_xxd+"@@"+Sbrith_xxd+"##"+Stell_xxd+"$$"+Saddress_xxd+"%%"+Squestion_xxd+"^^"+Sanswer_xxd+"&&"+Snote_xxd);
		if(x <= 0){
			System.out.print("注册失败");
			out.print("<script>alert('注册失败');location.href='AdminAddStu_xxd.jsp'</script>");
		} else {
			System.out.print("注册成功");
			HttpSession session = req.getSession();
			session.setAttribute("a", Sname_xxd);
			req.getRequestDispatcher("AdminAddStuStatus_xxd.jsp").forward(req, resp);
		}
	}
	private void regAdmin(HttpServletRequest req, HttpServletResponse resp) 
			throws ServletException, IOException{
		String useName_xxd = req.getParameter("useName_xxd");
		String pwd_xxd = req.getParameter("pwd_xxd");
		PrintWriter out = resp.getWriter();
		int y = new AdminDaoImpl_xxd().insertAdmin_xxd(new Admin_xxd(useName_xxd,pwd_xxd));
//		System.out.println(useName_xxd+"---------------"+"\n"+pwd_xxd+"----------------");

		if(y <= 0){
			System.out.print("注册失败");
			out.print("<script>alert('注册失败');location.href='AdminReg_xxd.jsp'</script>");
		} else {
			System.out.print("注册成功!");
			HttpSession session = req.getSession();
			session.setAttribute("useName_xxd", useName_xxd);
			out.print("<script>alert('注册成功!');location.href='supAdminlogin_xxd.jsp'</script>");
		}
	}	
	private void loginServ(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		PrintWriter out = resp.getWriter();
		String code_xxd = req.getParameter("code_xxd");
		String sbnumber_xxd = (String) req.getSession().getAttribute("sbnumber_xxd");
		if (!sbnumber_xxd.equalsIgnoreCase(code_xxd)) {
			out.print("<script>alert('验证码错误!');location.href='AdminMain_xxd.jsp'</script>");
			return;
		}
		String useName_xxd = req.getParameter("useName_xxd");
		String pwd_xxd = req.getParameter("pwd_xxd");
		int x = new AdminDaoImpl_xxd().UseNameandpwd(useName_xxd, pwd_xxd);

		if (x < 1) {
//			System.out.println("登录失败");
			out.print("<script>alert('用户名或密码错误');location.href='AdminMain_xxd.jsp'</script>");
			return;
		} else {
//			System.out.println("登录成功");
			HttpSession session = req.getSession();
			session.setAttribute("useName_xxd", useName_xxd);
			session.setAttribute("b", pwd_xxd);
			req.getRequestDispatcher("Adminlogin_xxd.jsp").forward(req, resp);
		}

	}
	private boolean checkAdminServ(HttpServletRequest req,
			HttpServletResponse resp) throws ServletException, IOException {
		boolean flag = false;
		String useName_xxd = req.getParameter("useName_xxd");
		PrintWriter out = resp.getWriter();
		if (useName_xxd == null || useName_xxd == "") {
			out.print("<script>alert('用户名不能为空');location.href='AdminReg_xxd.jsp'</script>");
			return false;
		}
		int x = new AdminDaoImpl_xxd().checkuseNameIsExist(useName_xxd);
//		System.out.println("x=" + x + "--------------------");
		if (x <= 0) {
			HttpSession session = req.getSession();
			session.setAttribute("usename_xxd", useName_xxd);
			out.print("<script>alert('用户名可以使用');location.href='AdminReg_xxd.jsp'</script>");
			flag = true;
		} else {
			out.print("<script>alert('该用户名已存在!');location.href='AdminReg_xxd.jsp'</script>");
			return flag;
		}
		return flag;
	}
}

3.StudentServ.java(学生服务类)

   package com.xxd.Service;

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

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;



import com.xxd.DaoImpl.StudentDaoImpl_xxd;
import com.xxd.DaoImpl.StudentStatusImpl_xxd;
import com.xxd.entity.StudentStatus_xxd;
import com.xxd.entity.Student_xxd;

@WebServlet(name = "StudentService_xxd", urlPatterns = "/StudentService_xxd")
public class StudentService_xxd extends HttpServlet{
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		doPost(req, resp);

	}

	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		
		String str = req.getParameter("act");
		if ("regstudent".equals(str)) {
			regstudentServ(req, resp);
		} else if ("findPwd1".equals(str)) {
			findPwd1Serv(req, resp);
		} else if ("findPwd2".equals(str)) {
			findPwd2Serv(req, resp);
		} else if ("findPwd3".equals(str)) {
			findPwd3Serv(req, resp);
		} else if ("stuLogin".equals(str)){
			stuLogin(req,resp);
		} else if ("modPwd".equals(str)){
			modPwdServ(req,resp);
		} else if ("getStuInfo".equals(str)){
			getStuInfoServ(req,resp);
		} else if ("updateStuInfo".equals(str)){
			updateStuInfoServ(req,resp);
		} else if ("selectStuAndStatusInfo".equals(str)){
			selectStuAndStatusInfoServ(req,resp);
		}else if("exist".equals(str)){
			existServ(req,resp);
		}else if("queryAllStuInfo".equals(str)){
			queryAllStuInfoServ(req,resp);
		}else if("AdminModifyStu".equals(str)){
			AdminModifyStuServ(req,resp);
		}else if("delstu".equals(str)){
			delstuServ(req,resp);
		}else if("queryStuBySname".equals(str)){
			queryStuBySnameServ(req,resp);
		}else if("queryStuBySid".equals(str)){
			queryStuBySidServ(req,resp);
		}else if("ModifyStuBySid".equals(str)){
			ModifyStuBySidServ(req,resp);
		}else if("ModifyStuBySname".equals(str)){
			ModifyStuBySnameServ(req,resp);
		}
	}
	private void queryStuBySidServ(HttpServletRequest req,
			HttpServletResponse resp) throws ServletException, IOException {
		long Sid_xxd = Long.valueOf(req.getParameter("Sid_xxd"));
		List<Student_xxd> list = new StudentDaoImpl_xxd().queryStuBySid(Sid_xxd);
		req.getSession().setAttribute("studentList", list);
		req.getRequestDispatcher("queryAllStuInfo_xxd.jsp").forward(req, resp);
	}
	private void ModifyStuBySidServ(HttpServletRequest req,
			HttpServletResponse resp) throws ServletException, IOException {
		long Sid_xxd = Long.valueOf(req.getParameter("Sid_xxd"));
		List<Student_xxd> list = new StudentDaoImpl_xxd().queryStuBySid(Sid_xxd);
		req.getSession().setAttribute("studentList", list);
		req.getRequestDispatcher("AdminModifyStu_xxd.jsp").forward(req, resp);
	}
	private void ModifyStuBySnameServ(HttpServletRequest req,
			HttpServletResponse resp) throws ServletException, IOException {
		String Sname_xxd = req.getParameter("Sname_xxd").trim();
		List<Student_xxd> list = new StudentDaoImpl_xxd().queryStuBySname(Sname_xxd);
		req.getSession().setAttribute("studentList", list);
		req.getRequestDispatcher("AdminModifyStu_xxd.jsp").forward(req, resp);
	}
	private void queryStuBySnameServ(HttpServletRequest req,
			HttpServletResponse resp) throws ServletException, IOException {
		String Sname_xxd = req.getParameter("Sname_xxd").trim();
		List<Student_xxd> list = new StudentDaoImpl_xxd().queryStuBySname(Sname_xxd);
		req.getSession().setAttribute("studentList", list);
		req.getRequestDispatcher("queryAllStuInfo_xxd.jsp").forward(req, resp);
	}
	private void delstuServ(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		long Sid_xxd = Long.valueOf(req.getParameter("Sid_xxd"));
		// System.out.println("id="+ id+"   ------");
		int x = new StudentDaoImpl_xxd().delstu(Sid_xxd);
		PrintWriter out = resp.getWriter();
		if (x <= 0) {
			out.print("<script>alert('请先删除学籍表或刷新列表!');location.href='AdminModifyStu_xxd.jsp'</script>");
		} else {
			out.print("<script>alert('删除用户成功,请进行刷新页面!');location.href='AdminModifyStu_xxd.jsp'</script>");
			req.getRequestDispatcher("AdminModifyStu_xxd.jsp").forward(req, resp);
		}
	}
	private void queryAllStuInfoServ(HttpServletRequest req,
			HttpServletResponse resp) throws ServletException, IOException {
		List<Student_xxd> list = new StudentDaoImpl_xxd
				().queryAllStuInfo();
		req.getSession().setAttribute("studentList", list);
		req.getRequestDispatcher("queryAllStuInfo_xxd.jsp").forward(req, resp);
	}

	private void existServ(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		req.getSession().invalidate();
		req.getRequestDispatcher("StudentMain_xxd.jsp").forward(req, resp);

	}
	private void AdminModifyStuServ(HttpServletRequest req,
			HttpServletResponse resp) throws ServletException, IOException {
		String Sname_xxd = req.getParameter("Sname_xxd");
		String Spwd_xxd = req.getParameter("Spwd_xxd");
		String Sgender_xxd = req.getParameter("Sgender_xxd");
		String Sbrith_xxd = req.getParameter("Sbrith_xxd");
		String Stell_xxd = req.getParameter("Stell_xxd");
		String Saddress_xxd = req.getParameter("Saddress_xxd");
		String Squestion_xxd = req.getParameter("Squestion_xxd");
		String Sanswer_xxd = req.getParameter("Sanswer_xxd");
		String Snote_xxd = req.getParameter("Snote_xxd");
		int x = new StudentDaoImpl_xxd().updateStuInfoByStudent(new Student_xxd(Sname_xxd,Spwd_xxd,Sgender_xxd,Sbrith_xxd,Stell_xxd,
				Saddress_xxd,Squestion_xxd,Sanswer_xxd,Snote_xxd));
		PrintWriter out = resp.getWriter();
//		System.out.println("x="+x+"----------------------");
		if (x <= 0) {
			out.print("<script>alert('信息修改失败');location.href='Adminlogin_xxd.jsp'</script>");
			return;
		} else {
			List<Student_xxd> list = new StudentDaoImpl_xxd().queryAllStuInfo();
			req.setAttribute("studentlist", list);
			out.print("<script>alert('信息修改成功,请刷新列表!');location.href='AdminModifyStu_xxd.jsp'</script>");
			return;
		}
	}
	private void updateStuInfoServ(HttpServletRequest req,
			HttpServletResponse resp) throws ServletException, IOException {
		String Sgender_xxd = req.getParameter("Sgender_xxd");
		String Sbrith_xxd = req.getParameter("Sbrith_xxd");
		String Stell_xxd = req.getParameter("Stell_xxd");
		String Saddress_xxd = req.getParameter("Saddress_xxd");
		String Squestion_xxd = req.getParameter("Squestion_xxd");
		String Sanswer_xxd = req.getParameter("Sanswer_xxd");
		String Snote_xxd = req.getParameter("Snote_xxd");
		String Sname_xxd = (String) req.getSession().getAttribute("a");
		int x = new StudentDaoImpl_xxd().updateStuInfoByStudent(new Student_xxd(Sname_xxd,"1",Sgender_xxd,Sbrith_xxd,Stell_xxd,
				Saddress_xxd,Squestion_xxd,Sanswer_xxd,Snote_xxd));
//		System.out.println(Sname_xxd+"!!"+Sgender_xxd+"@@"+Sbrith_xxd+"##"+Stell_xxd+"$$"+
//				Saddress_xxd+"%%"+Squestion_xxd+"66"+Sanswer_xxd+"&&"+Snote_xxd);
		PrintWriter out = resp.getWriter();
//		System.out.println("x="+x+"----------------------");
		if (x <= 0) {
			out.print("<script>alert('个人信息修改失败');location.href='Stulogin_xxd.jsp'</script>");
			return;
		} else {
			out.print("<script>alert('个人信息修改成功');location.href='Stulogin_xxd.jsp'</script>");
			return;
		}
	}
	private void selectStuAndStatusInfoServ(HttpServletRequest req,
			HttpServletResponse resp) throws ServletException, IOException {
		HttpSession session = req.getSession();
		String Sname_xxd = (String) session.getAttribute("a");
		Student_xxd s = new StudentDaoImpl_xxd().queryStuInfoByUserName(Sname_xxd);
		long Xid1_xxd = new StudentDaoImpl_xxd().checkstuId(Sname_xxd);
		StudentStatus_xxd sta = new StudentStatusImpl_xxd().queryStuStaInfoByXid(Xid1_xxd);
		PrintWriter out = resp.getWriter();
		if (s == null || sta == null) {
			out.print("<script>alert('请完善学籍信息后再进行查询!');location.href='Stulogin_xxd.jsp'</script>");
			return;
		} else {
			req.setAttribute("s", s);
			req.setAttribute("t", sta);
			req.getRequestDispatcher("selectStuInfo_xxd.jsp").forward(req, resp);
		}

	}
	private void getStuInfoServ(HttpServletRequest req,
			HttpServletResponse resp) throws ServletException, IOException {
		HttpSession session = req.getSession();
		String Sname_xxd = (String) session.getAttribute("a");
		Student_xxd s = new StudentDaoImpl_xxd().queryStuInfoByUserName(Sname_xxd);
		PrintWriter out = resp.getWriter();
		if (s == null) {
			out.print("<script>alert('学生用户不存在或者登录失效');location.href='Stulogin_xxd.jsp'</script>");
			return;
		} else {
			req.setAttribute("s", s);
			req.getRequestDispatcher("stuModifyInfo_xxd.jsp").forward(req, resp);
		}

	}
	private void modPwdServ(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		// 首先拿到原密码
		String Spwd_xxd = req.getParameter("Spwd_xxd");
		// 然后判断原密码是否正确,调用DAO层的函数,去数据库中查找该用户的密码是否正确
		HttpSession session = req.getSession();
		String Sname_xxd = (String) session.getAttribute("a");
		int x = new StudentDaoImpl_xxd().queryStuBySnameAndSpwd(Sname_xxd, Spwd_xxd);
		PrintWriter out = resp.getWriter();
		if (x <= 0) {
			out.print("<script>alert('原密码不正确');location.href='stuModifypwd_xxd.jsp'</script>");
			return;
		} else {
			// 原密码正确,就对密码进行修改
			String Spwd1_xxd = req.getParameter("Spwd1_xxd");
			// 通过调用DAO的函数,来修改密码
			int y = new StudentDaoImpl_xxd().updatePwdBySname(Sname_xxd, Spwd1_xxd);
			if (y <= 0) {
				out.print("<script>alert('密码修改失败');location.href='stuModifypwd_xxd.jsp'</script>");
				return;
			} else {
				out.print("<script>alert('密码修改成功');location.href='StudentMain_xxd.jsp'</script>");
				return;
			}
		}
	}
	private void stuLogin(HttpServletRequest req, HttpServletResponse resp) 
			throws ServletException, IOException{
		PrintWriter out = resp.getWriter();
		String code_xxd = req.getParameter("code_xxd");
		String sbnumber_xxd = (String) req.getSession().getAttribute("sbnumber_xxd");
		if (!sbnumber_xxd.equalsIgnoreCase(code_xxd)) {
			out.print("<script>alert('验证码错误!');location.href='StudentMain_xxd.jsp'</script>");
			return;
		}
		String Sname_xxd = req.getParameter("Sname_xxd");
		String Spwd_xxd = req.getParameter("Spwd_xxd");
		int x = new StudentDaoImpl_xxd().queryStuBySnameAndSpwd(Sname_xxd, Spwd_xxd);
		if (x < 1) {
//			System.out.println("用户名或密码不正确!");
			out.print("<script>alert('登录失败,用户名或密码错误!');location.href='StudentMain_xxd.jsp'</script>");
			return;
		} else {
//			System.out.println("登录成功");
			HttpSession session = req.getSession();
			session.setAttribute("a", Sname_xxd);
			req.setAttribute("b", Spwd_xxd);
			req.getRequestDispatcher("Stulogin_xxd.jsp").forward(req, resp);
		}

	}

	private void findPwd3Serv(HttpServletRequest req, HttpServletResponse resp) 
			throws ServletException, IOException{
		String Spwd_xxd = req.getParameter("Spwd1_xxd");
		HttpSession session = req.getSession();
		Student_xxd s = (Student_xxd) session.getAttribute("stu");
		String Sname_xxd = s.getSname_xxd();
		int x = new StudentDaoImpl_xxd().updatePwdBySname(Sname_xxd, Spwd_xxd);
		PrintWriter out = resp.getWriter();
		if(x <= 0){
			out.print("<script>alert('密码修改失败');location.href='findpwd3_xxd.jsp'</script>");
			return;
		} else {
			out.print("<script>alert('密码修改成功!');location.href='findpwd3_xxd.jsp'</script>");
			req.getRequestDispatcher("StudentMain_xxd.jsp").forward(req, resp);
		}
		
		
	}

	private void findPwd2Serv(HttpServletRequest req, HttpServletResponse resp) 
			throws ServletException, IOException{
		String Sanswer_xxd = req.getParameter("Sanswer_xxd");
		HttpSession session = req.getSession();
		Student_xxd s = (Student_xxd) session.getAttribute("stu");
		String Sname_xxd = s.getSname_xxd();
		String Squestion_xxd = s.getSquestion_xxd();
		int x = new StudentDaoImpl_xxd().modifyPwdByUserNameAndQuestionAndAnswer(Sname_xxd, Squestion_xxd, Sanswer_xxd);
		PrintWriter out = resp.getWriter();
		if(x <= 0){
			out.print("<script>alert('密码找回答案不正确');location.href='findpwd2_xxd.jsp'</script>");
			return;
		} else {
			req.getRequestDispatcher("findpwd3_xxd.jsp").forward(req, resp);
		}
	}

	private void findPwd1Serv(HttpServletRequest req, HttpServletResponse resp) 
			throws ServletException, IOException{
		String Sname_xxd = req.getParameter("Sname_xxd");
		Student_xxd s = new StudentDaoImpl_xxd().queryStuInfoByUserName(Sname_xxd);
		PrintWriter out = resp.getWriter();
		if (s == null) {
			out.print("<script>alert('用户名不存在');location.href='findpwd1_xxd.jsp'</script>");
			return;
		} else {
			HttpSession session = req.getSession();
			session.setAttribute("stu", s);
			req.getRequestDispatcher("findpwd2_xxd.jsp").forward(req, resp);
		}
	}

	private void regstudentServ(HttpServletRequest req, HttpServletResponse resp) 
			throws ServletException, IOException{
		String Sname_xxd = req.getParameter("Sname_xxd");
		String Spwd_xxd = req.getParameter("Spwd_xxd");
		String Sgender_xxd = req.getParameter("Sgender_xxd");
		String Sbrith_xxd = req.getParameter("Sbrith_xxd");
		String Stell_xxd = req.getParameter("Stell_xxd");
		String Saddress_xxd = req.getParameter("Saddress_xxd");
		String Squestion_xxd = req.getParameter("Squestion_xxd");
		String Sanswer_xxd = req.getParameter("Sanswer_xxd");
		String Snote_xxd = req.getParameter("Snote_xxd");
		PrintWriter out = resp.getWriter();
		int x = new StudentDaoImpl_xxd().insertStudent_xxd(new Student_xxd(Sname_xxd,Spwd_xxd,Sgender_xxd,Sbrith_xxd,Stell_xxd,Saddress_xxd,Squestion_xxd,Sanswer_xxd,Snote_xxd));
//		System.out.println("!!"+Sname_xxd+"--"+Spwd_xxd+"~~"+Sgender_xxd+"@@"+Sbrith_xxd+"##"+Stell_xxd+"$$"+Saddress_xxd+"%%"+Squestion_xxd+"^^"+Sanswer_xxd+"&&"+Snote_xxd);
		if(x <= 0){
//			System.out.print("注册失败");
			out.print("<script>alert('注册失败');location.href='StudentReg_xxd.jsp'</script>");
		} else {
//			System.out.print("注册成功");
			out.print("<script>alert('注册成功');location.href='StudentReg_xxd.jsp'</script>");
			req.setAttribute("a", Sname_xxd);
			req.getRequestDispatcher("StudentMain_xxd.jsp").forward(req, resp);
		}
	}	
}

4.StudentstatusServ.java(学生学籍服务类)

package com.xxd.Service;

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

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;


import com.xxd.DaoImpl.StudentDaoImpl_xxd;
import com.xxd.DaoImpl.StudentStatusImpl_xxd;
import com.xxd.entity.StudentStatus_xxd;
import com.xxd.entity.Student_xxd;

@WebServlet(name="StudentStatusServ_xxd",urlPatterns="/StudentStatusServ_xxd")
public class StudentStatusServ_xxd extends HttpServlet {
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException{
		doPost(req, resp);

	}
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		String str = req.getParameter("act");

		if ("addstusta".equals(str)) {
			addStuStatusServ(req,resp);
		}else if("getStuStaInfo".equals(str)) {
			getStuStaInfoServ(req,resp);
		}else if("updateStuStaInfo".equals(str)) {
			updateStuStaInfoServ(req,resp);
		}else if("getStuStacountInfo".equals(str)){
			getStuStacountInfoServ(req,resp);
		}else if("selectStatusInfo".equals(str)){
			selectStatusInfoServ(req,resp);
		}else if("delsta".equals(str)){
			delstaServ(req,resp);
		}
		
	}
	private void delstaServ(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		long Xid_xxd = Long.valueOf(req.getParameter("Xid_xxd"));
		// System.out.println("id="+ id+"   ------");
		int x = new StudentStatusImpl_xxd().delsta(Xid_xxd);
		PrintWriter out = resp.getWriter();
		if (x <= 0) {
			out.print("<script>alert('删除用户失败');location.href='AdminModifySta_xxd.jsp'</script>");
		} else {
			out.print("<script>alert('删除用户成功');location.href='AdminModifyStu_xxd.jsp'</script>");
			req.getRequestDispatcher("AdminModifyStu_xxd.jsp").forward(req, resp);
		}
	}

	

private void selectStatusInfoServ(HttpServletRequest req,
			HttpServletResponse resp) throws ServletException, IOException{
	long Xid1_xxd = Long.valueOf(req.getParameter("id"));
	StudentStatus_xxd sta = new StudentStatusImpl_xxd().queryStuStaInfoByXid(Xid1_xxd);
	PrintWriter out = resp.getWriter();
	if (sta == null) {
		out.print("<script>alert('该生学籍尚未填写!');location.href='queryAllStuInfo_xxd.jsp'</script>");
		return;
	} else {
		HttpSession session = req.getSession();
		session.setAttribute("a", Xid1_xxd);
		req.setAttribute("t", sta);
		req.getRequestDispatcher("selectStaStatus_xxd.jsp").forward(req, resp);
	}

}
	
private void updateStuStaInfoServ(HttpServletRequest req,
			HttpServletResponse resp) throws ServletException, IOException {
		String Xschool_xxd = req.getParameter("Xschool_xxd");
		String Xspecial_xxd = req.getParameter("Xspecial_xxd");
		String Xclass_xxd = req.getParameter("Xclass_xxd");
		String Xeducation_xxd = req.getParameter("Xeducation_xxd");
		String Xtotalcredit_xxd = req.getParameter("Xtotalcredit_xxd");
		String Xschoolyear_xxd = req.getParameter("Xschoolyear_xxd");
		String Xgraduation_xxd = req.getParameter("Xgraduation_xxd");
		long  Xid1_xxd = Long.valueOf(req.getParameter("Xid1_xxd"));
		int x = new StudentStatusImpl_xxd().updateStuStaInfoByStudentSta(new StudentStatus_xxd(Xid1_xxd,Xschool_xxd,Xspecial_xxd,Xclass_xxd,
				Xeducation_xxd,Xtotalcredit_xxd,Xschoolyear_xxd,Xgraduation_xxd));
		PrintWriter out = resp.getWriter();
//		System.out.println("x="+x+"----------------------");
		if (x <= 0) {
			out.print("<script>alert('个人学籍修改失败');location.href='Stulogin_xxd.jsp'</script>");
			return;
		} else {
			out.print("<script>alert('个人学籍修改成功');location.href='Stulogin_xxd.jsp'</script>");
			return;
		}
	}
	private void getStuStaInfoServ(HttpServletRequest req,
			HttpServletResponse resp) throws ServletException, IOException {
		HttpSession session = req.getSession();
		String Sname_xxd = (String) session.getAttribute("a");
		long Xid1_xxd = new StudentDaoImpl_xxd().checkstuId(Sname_xxd);
		StudentStatus_xxd sta = new StudentStatusImpl_xxd().queryStuStaInfoByXid(Xid1_xxd);
		PrintWriter out = resp.getWriter();
		if (sta == null) {
			out.print("<script>alert('学生学籍未填写或者登录失效');location.href='Stulogin_xxd.jsp'</script>");
			return;
		} else {
			req.setAttribute("t", sta);
			req.getRequestDispatcher("stuStatusModifyInfo_xxd.jsp").forward(req, resp);
		}

	}
	private void addStuStatusServ(HttpServletRequest req,
			HttpServletResponse resp) 
		throws ServletException, IOException {
		long  Xid1_xxd = Long.valueOf(req.getParameter("id"));
		String Xschool_xxd = req.getParameter("Xschool_xxd");
		String Xspecial_xxd = req.getParameter("Xspecial_xxd");
		String Xclass_xxd = req.getParameter("Xclass_xxd");
		String Xeducation_xxd = req.getParameter("Xeducation_xxd");
		String Xtotalcredit_xxd = req.getParameter("Xtotalcredit_xxd");
		String Xschoolyear_xxd = req.getParameter("Xschoolyear_xxd");
		String Xgraduation_xxd = req.getParameter("Xgraduation_xxd");
		int x = new StudentStatusImpl_xxd().addStudentStatus(new StudentStatus_xxd(Xid1_xxd, Xschoolyear_xxd, Xspecial_xxd, Xclass_xxd,
				Xeducation_xxd, Xtotalcredit_xxd, Xschoolyear_xxd, Xgraduation_xxd));
		PrintWriter out = resp.getWriter();
		if (x <= 0) {
			out.print("<script>alert('学籍添加失败');location.href='addStuStatusInfo_xxd.jsp'</script>");
			return;
		} else {
			out.print("<script>alert('学籍添加成功');location.href='Stulogin_xxd.jsp'</script>");
			return;
		}
	}
	private void getStuStacountInfoServ(HttpServletRequest req,
			HttpServletResponse resp) throws ServletException, IOException {
		HttpSession session = req.getSession();
		String Sname_xxd = (String) session.getAttribute("a");
		//子表外键
		long Xid1_xxd = new StudentDaoImpl_xxd().checkstuId(Sname_xxd);
		int x  =  (int) new StudentStatusImpl_xxd().checkXid(Xid1_xxd);
		PrintWriter out = resp.getWriter();
		if ( x > 1) {
			out.print("<script>alert('学生学籍信息已存在,不可重复填写!');location.href='Stulogin_xxd.jsp'</script>");
			return;
		} else {
			req.getRequestDispatcher("addStuStatusInfo_xxd.jsp").forward(req, resp);
		}

	}
}

5.IdentityCodePicServ.java(验证码)

package com.xxd.Service;

import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.Random;

import javax.imageio.ImageIO;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet(name = "IdentityCodePicServ_xxd", urlPatterns = "/IdentityCodePicServ_xxd")
public class IdentityCodePicServ_xxd extends HttpServlet{
	private int width_xxd = 150;
	private int height_xxd = 35;
	private int coderCount_xxd = 4;
	
	private int x_xxd = 0;
	private int fontHeight_xxd;
	private int codeY_xxd;
	
	char[] codeSequence_xxd ={'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
			'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
			'X', 'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		this.doPost(request, response);

	}

	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		this.service(request, response);
	}
	public void init(){
		String strWidth_xxd = this.getInitParameter("width_xxd");
		String strHeiht_xxd = this.getInitParameter("height");
		String strCodeCount_xxd = this.getInitParameter("coderCount_xxd");
		if(strWidth_xxd != null && strWidth_xxd.length() != 0){
			width_xxd = Integer.parseInt(strWidth_xxd);
		}
		if(strHeiht_xxd != null && strHeiht_xxd.length() != 0){
			height_xxd =Integer.parseInt(strHeiht_xxd);
		}
		if(strCodeCount_xxd != null && strCodeCount_xxd.length() != 0){
			coderCount_xxd = Integer.parseInt(strCodeCount_xxd);
		}
		x_xxd = width_xxd / (coderCount_xxd + 1);
		fontHeight_xxd =height_xxd -2;
		codeY_xxd = height_xxd - 4;
	}
	public void service(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		// 产生图片
		BufferedImage bi = new BufferedImage(width_xxd, height_xxd,
				BufferedImage.TYPE_INT_RGB);
		// 网图片中加载图片的工具
		Graphics2D g = bi.createGraphics();
		// 添加背景
		g.setColor(Color.WHITE);
		g.fillRect(0, 0, width_xxd, height_xxd);
		// 创建字体
		Font font = new Font("Fixedsys", Font.PLAIN | Font.BOLD, fontHeight_xxd);
		// 设置字体
		g.setFont(font);
		// 画边框
		g.setColor(Color.black);
		g.drawRect(0, 0, width_xxd - 1, height_xxd - 1);
		// 画干扰线
		Random random = new Random();
		g.setColor(Color.PINK);
		for (int i = 0; i < 100; i++) {
			int x = random.nextInt(width_xxd);
			int y = random.nextInt(height_xxd);
			int xl = random.nextInt(12);
			int yl = random.nextInt(12);
			g.drawLine(x, y, x + xl, y + yl);

		}
		StringBuffer sbnumber = new StringBuffer();
		// 生成随机码
		for (int i = 0; i < this.coderCount_xxd; i++) {
			String strRand = String.valueOf(codeSequence_xxd[random.nextInt(36)]);
			// 随机产生颜色分量来创建颜色
			int red = random.nextInt(255);
			int green = random.nextInt(255);
			int blue = random.nextInt(255);
			//
			g.setColor(new Color(red, green, blue));
			g.drawString(strRand, (i + 1) * x_xxd - 6, codeY_xxd);
			// 把每次生成的验证码放在缓冲区
			sbnumber.append(strRand);

		}
		// 把生成的验证码放在session中
		request.getSession().setAttribute("sbnumber_xxd", sbnumber.toString());
		System.out.println(sbnumber+" ---------");
		// 把最终生成 图片 响应到页面去
		response.setContentType("image/jpeg");
		ServletOutputStream sos = response.getOutputStream();
		// 把图片 发送出去
		ImageIO.write(bi, "jpeg", sos);
		sos.close();
	}
	
}

四.JSP实现代码

在这里插入图片描述
主页显示效果如下:
在这里插入图片描述

1.main.jsp代码如下:

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'main_xxd.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<style type="text/css">
	body{
	background-image: url(images/timg123.jpg);
	font-family:幼圆;
	}
	body .bkyd{
	margin-top: 150px;
	}
	
</style>
  </head>
  
  <body>
  <table border="0" width="600" height="350" align="center" class="bkyd">
  <tr>
  <th align="center" colspan="3">请选择需要登录的用户!</th>
  </tr>
  
  <tr><th width="200" align="center"><input type="button" name="SupAdmint_xxd" value="超级管理员登录"
   οnclick="window.location.href='supAdmin_xxd.jsp'"/></th>
  	<th width="200" align="center"><input type="button" name="Admint_xxd" value="&nbsp;&nbsp;&nbsp;&nbsp;管理员登录&nbsp;&nbsp;&nbsp;&nbsp;"
  	οnclick="window.location.href='AdminMain_xxd.jsp'"/></th>
  	<th width="200" align="center"><input type="button" name="Student_xxd" value="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;学生登录&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
  	οnclick="window.location.href='StudentMain_xxd.jsp'"/></th>
  </tr>
  </table>
  
  </body>
</html>

超级管理员登录页面显示如下图所示:
在这里插入图片描述
2.SupAdmin.jsp代码如下所示:

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'supAdmin_xxd.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<style type="text/css">
	
	body{
	background: url("images/01.jpg");
	font-family:幼圆;
	}
    	.clj{
 			color:white;
 			text-decoration: none;
 				}
 		.clj:HOVER {
		color: yellow;
		text-decoration: underline;
}
	.bgbk{
	margin-top: 150px;
	}	
</style>
  </head>
  <script type="text/javascript">
  function newCode() {
		var today = new Date();
		document.getElementById("imgNumber").src = "IdentityCodePicServ_xxd?tm="
				+ today.getTime();
		
	}
  </script>
  <body>
     <form method="post" action="SupAdminServ_xxd?act=login" οnsubmit="return check(this)"
		name="from1">
		<table border="2" width="550" height="350" align="center" class="bgbk">
			<tr>
				<td colspan="2" align="center" class="clj"><h4>
						<b>超&nbsp;&nbsp;级&nbsp;&nbsp;管&nbsp;&nbsp;理&nbsp;&nbsp;员&nbsp;&nbsp;登&nbsp;&nbsp;录&nbsp;&nbsp;页&nbsp;&nbsp;面</b>
					</h1></td>
			</tr>
		
			<tr>
				<td align="center" width="200" class="clj">用户名:</td>
				<td width="350"><input type="text" id="supname_xxd" 
					name="supname_xxd" style="width: 320px;" ></td>
			</tr>
			<tr>
				<td align="center" width="200" class="clj">用户密码:</td>
				<td><input type="password" name="suppwd_xxd" id="suppwd_xxd"
					style="width: 322px; "></td>
			</tr>
			<tr>
				<td  class="clj" align="center">验证码:</td>
				<td><input  type="text" name="code_xxd" style="height: 28px; width: 80px; "/> <img
					src="IdentityCodePicServ_xxd" id="imgNumber" /> <a
					href="javascript:newCode()" class="clj">看不清,换一张</a></td>

			</tr>
			<tr>
				<td colspan="2" align="center">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" value="登录" id="btn1">&nbsp;&nbsp;<input type="reset" value="重置" id="btn2">&nbsp;&nbsp;&nbsp;&nbsp;<a class="clj" href="main_xxd.jsp">返回主页面</a></td>
			</tr>
		</table> 
	</form>
  </body>
</html>

3.超级管理员功能操作如图所示
在这里插入图片描述

supAdminlogin.jsp

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'supAdminlogin_xxd.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<style type="text/css">
	body{
		background-image: url(images/bj05.jpg);
		font-family:幼圆;
	}
	body .jz{
	margin-top: 60;
	color: white;
	}
	body .bg{
	margin-top: 30;
	color: white;
	}
</style>
  </head>
  
  <body>
    <center class="jz">
  超级管理员:<%=session.getAttribute("a")%>
	欢迎您登录!<br>
  <table border="2" height="250" width="450" class="bg">
  <tr align="center"><h3><th>请选择需要使用的功能!</th></tr>
  <tr align="center"><td><input type="button" name="AdminReg_xxd" value="注册管理员"
  οnclick="window.location.href='AdminReg_xxd.jsp'"/></td></tr>
  <tr align="center"><td><input type="button" name="AdminMain_xxd" value="操作管理员"
  οnclick="window.location.href='AdminService_xxd?act=queryAlladminInfo'"/></td></tr>
    <tr align="center"><td><input type="button" name="AdminMain_xxd" value="管理员登录"
  οnclick="window.location.href='AdminMain_xxd.jsp'"/></td></tr>
  <tr align="center"><td><input type="button" name="btn1" value="&nbsp;&nbsp;安全退出&nbsp;&nbsp;"
  οnclick="window.location.href='SupAdminServ_xxd?act=exist'"></td>
  </tr>
  </table>
  

  </center>
  </body>
</html>

4.超级管理员操作管理员页面如图所示:
在这里插入图片描述
SupModifyAdmin.jsp

<%@page import="com.xxd.entity.Admin_xxd"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'SupModifyAdmin_xxd.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<style>
	body{
	background-image: url(images/timg32.jpg);
	font-family:幼圆;
	}
	.tb_bg{
	margin-top:40;
	}
</style>
<script>
	function check1(form2){
		if(form2.Sname_xxd.value == ""){
			alert("学生姓名不能为空");
			form2.Sname_xxd.focus();
			return falsel;
			}
		}
		
	function check(form3){
		if(form3.Sid_xxd.value == ""){
			alert("学生学号不能为空");
			form3.Sid_xxd.focus();
			return false;
			}
		}
		function showForm() {
		var myradio = document.getElementsByName("queryAdmin_xxd");
		var div = document.getElementById("c").getElementsByTagName("div");
		for (var i = 0; i < div.length; i++) {
			if (myradio[i].checked) {
				div[i].style.display = "block";
			} else {
				div[i].style.display = "none";
			}
		}
	}
</script>
  </head>
    <body>
  <p>
	<div>
		<input type="radio" value="按管理员名称查询" name="queryAdmin_xxd" checked="checked"
			οnclick="showForm()" />按管理员名称查询 <input type="radio" value="按管理员ID查询"
			name="queryAdmin_xxd" οnclick="showForm()">按管理员ID查询
	</div>
	</p>
		<div id="c">
		<div class="c1">
			<form name="form2" method="post"
				action="AdminService_xxd?act=ModifyAdminByAname"
				οnsubmit="return check1(form2)">
				管理员名称:<input name="useName_xxd"><input type="submit" value="提交"
					name="btn1">
			</form>
		</div>
		</p>
		<div class="c2" style="display:none;">
			<form name="form3" method="post"
				action="AdminService_xxd?act=ModifyAdminByAid"
				οnsubmit="return check2(form3)">
				管理员ID:<input name="Aid_xxd"><input type="submit" value="提交"
					name="btn1">
			</form>
		</div>
  </body>
    <%
 	List<Admin_xxd> list = (List<Admin_xxd>) session.getAttribute("adminList");
 	if(list == null || list.size() ==0){
  %>
  no data!
  <% 
  	}else{
  %>
  <table width="800" align="center" border="2" class="tb_bg">
  <tr align="center">
  <td>管理员ID</td>
  <td>管理员姓名</td>
  <td>管理员密码</td>
  <td>操作<td>
  </tr>
  <%
  	for(Admin_xxd a : list){
   %>
  <tr align="center">
  <form name="form2" method="post" action="AdminService_xxd?act=modifyAdminInfo">
  <td><input name="Aid_xxd" value="<%=a.getAid_xxd()%>" readonly="readonly"></td>
 <td><input name="useName_xxd" value="<%=a.getUseName_xxd()%>"></td>
 <td><input name="pwd_xxd" value="<%=a.getPwd_xxd()%>"></td>
 <td><input type="submit" name="btn2" value="修改"><input type="button" name="btn1" value="删除" 
 οnclick="window.location.href='AdminService_xxd?act=delAdmin&Aid_xxd='+<%=a.getAid_xxd()%>"><input type="button" name="btn1" value="刷新" 
 οnclick="window.location.href='AdminService_xxd?act=queryAlladminInfo'"></td>
 	</form>
 </tr>
  <%
  	}
   %>
  </table>
  		
  	<%
  		}
  	 %>
  	 <table width="780" align="center" border="0">
  	 <tr colspan="4" height=150 ><td>&nbsp;</td></tr>
  	 <tr ><td colspan="3" align="right"><input type="button" name="btn1" value="退出操作"
  	 οnclick="window.location.href='supAdminlogin_xxd.jsp'"/></td></tr>
  	 </table>

</html>

5.超级管理员注册管理员操作
在这里插入图片描述
AdminReg.jsp

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'AdminReg_xxd.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<style type="text/css">
	body{
		background-image: url(images/bj05.jpg);
		font-family:幼圆;
	}
	body .bg{
	margin-top: 60;
	color: white;
	}
	table .clj{
	color: white;
	text-decoration: none;
	}
	table .clj:HOVER{
	color: yellow;
	text-decoration: underline;
	}
	
</style>
  </head>
    <script type="text/javascript">
	function check(form1) {
		if (form1.useName_xxd.value == "") {
			alert("用户名不能为空");
			form1.useName_xxd.focus();
			return false;
		}

		if (form1.pwd_xxd.value == "") {
			alert("密码不能为空");
			form1.pwd_xxd.focus();
			return false;
		}

		if (form1.pwd2_xxd.value == "") {
			alert("确认密码不能为空");
			form1.pwd2_xxd.focus();
			return false;
		}

		if (form1.pwd_xxd.value != form1.pwd2_xxd.value) {
			alert("两次密码不一致");
			form1.pwd_xxd.focus();
			return false;
			
		}
	}
	function getAdmin(form1) {
		alert(document.getElementById("useName_xxd").value);
		return document.getElementById("useName_xxd").value;

	}
</script>
<%
	String useName_xxd = (String) session.getAttribute("usename_xxd");
	if (useName_xxd == null || "".equals(useName_xxd)) {
		useName_xxd = "";
	}
%>
  <body>
 
     <form name="form1" method="post" action="AdminService_xxd?act=reg"
  οnsubmit="return check(this)">
		<table width="360" border="1" align="center" class="bg">
			<tr>
				<th colspan="2" align="center" scope="row">管理员注册</th>

			</tr>
		<tr>
				<th width="213" scope="row">用户名:</th>
				<td width="337"> <!-- 检查用户名存在的按钮,这种写法一定要记忆下 -->
					<input type="text" name="useName_xxd" id="useName_xxd" value="<%=useName_xxd%>"><input
					type="button" value="检查用户名是否存在"
					οnclick="window.location.href='AdminService_xxd?act=checkAdmin&useName_xxd='+getAdmin(this)"></td>
			</tr>
			<tr>
				<th scope="row">密码:</th>
				<td><label for="pwd_xxd"></label> <input type="password" name="pwd_xxd"
					id="pwd_xxd"></td>
			</tr>
			<tr>
				<th scope="row">确认密码:</th>
				<td><label for="pwd2_xxd"></label> <input type="password"
					name="pwd2_xxd" id="pwd2_xxd"></td>
			</tr>
			<tr>
				<th colspan="2" scope="row"><input type="submit" name="btn1"
					id="btn1" value="提交"> <input type="reset" name="btn2"
					id="btn2" value="重置"> &nbsp; &nbsp;<a href="AdminMain_xxd.jsp" class="clj">登录</a> &nbsp;<a href="supAdminlogin_xxd.jsp" class="clj">返回</a></th>
			</tr>
		</table>
	</form>
  </body>
</html>

1.管理员登录界面
在这里插入图片描述
AdminMain.jsp

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'AdminMain_xxd.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<style type="text/css">
	body{
	background-image: url(images/bj.jpg);
	font-family:幼圆;
	}
	body .bgyd{
		margin-top: 150px;
	}
	body .bs{
	color: white;
	text-decoration: none;
	}
	body .bs:HOVER{
	color: blue;
	text-decoration: underline;
	}
</style>
  </head>
      <script type="text/javascript">
	function newCode() {
		var today = new Date();
		document.getElementById("imgNumber").src = "IdentityCodePicServ_xxd?tm="
				+ today.getTime();
		
	}
	function check(form1) {
		if (form1.useName_xxd.value == "") {
			alert("请输入用户名!");
			form1.useName_xxd.focus();
			return false;
		}
		if (form1.pwd_xxd.value == "") {
			alert("密码不能为空!");
			form1.pwd_xxd.focus();
			return false;
		}
	}
</script>
<%
	String str = (String) request.getAttribute("useName_xxd");
	if (str == null) {
		str = "";
	}
%>
  <body>
   <form method="post" action="AdminService_xxd?act=login" οnsubmit="return check(this)"
		name="from1">
		<table border="2" width="550" height="350" align="center" class="bgyd">
			<tr>
				<td colspan="2" align="center" class="bs"><h3>
						<b>管&nbsp;&nbsp;理&nbsp;&nbsp;员&nbsp;&nbsp;登&nbsp;&nbsp;录&nbsp;&nbsp;页&nbsp;&nbsp;面</b>
					</h1></td>
			</tr>
		
			<tr>
				<td class="bs" align="center" style="width: 280px; ">用户名:</td>
				<td ><input type="text" id="useName_xxd"
					name="useName_xxd" value="<%=str %>" style="width: 320px; "></td>
			</tr>
			<tr>
				<td class="bs" align="center">用户密码:</td>
				<td><input type="password" name="pwd_xxd" id="pwd_xxd"
					style="width: 322px; "></td>
			</tr>
			<tr>
				<td  class="bs" align="center">验证码:</td>
				<td><input  type="text" name="code_xxd" style="height: 28px; width: 80px; "/> <img
					src="IdentityCodePicServ_xxd" id="imgNumber" /> <a
					href="javascript:newCode()" class="bs">看不清,换一张</a></td>

			</tr>
			<tr>
				<td colspan="2" align="center">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" value="登录" id="btn1">&nbsp;&nbsp;<input type="reset" value="重置" id="btn2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="main_xxd.jsp" class="bs">返回主页面</a></td>
			</tr>
			
		</table> 
	</form>
  </body>
</html>


2.管理员功能界面
在这里插入图片描述
2.Adminlogin.jsp

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'Adminlogin_xxd.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<style>
	body {
	background-image: url(images/bj.jpg);
	font-family:幼圆;
	color: white;
	}
	body .bg{
	margin-top: 45;
	}
	table .clj{
	color: white;
	text-decoration: none;
	}
	table .clj:HOVER{
	color: yellow;
	text-decoration: underline;
	}

</style>
  </head>
  
  <body>
  <div>&nbsp;</div>
  <div>&nbsp;</div>
  <div>&nbsp;</div>
  <center>管理员:<%=session.getAttribute("useName_xxd")%> 欢迎登陆!<br>
  <table border="2" height="400" width="450" class="bg">
  <tr align="center"><h3><th colspan="2">请选择需要使用的功能!</th></tr>
  <tr align="center" ><td colspan="2"><input type="button" name="selectAllInfo_xxd" value="查看所有学生信息"
  οnclick="window.location.href='StudentService_xxd?act=queryAllStuInfo'"/></td></tr>
    <tr align="center"><td colspan="2"><input type="button" name="AdminModifyStu_xxd" value="修改相关学生信息"
  οnclick="window.location.href='AdminService_xxd?act=queryAllStuInfo'"/></td></tr>
  <tr align="center"><td colspan="2"><input type="button" name="AdminAddStu_xxd" value="&nbsp;&nbsp;&nbsp;&nbsp;添加学生信息&nbsp;&nbsp;&nbsp;&nbsp;"
  οnclick="window.location.href='AdminAddStu_xxd.jsp'"/></td></tr>
  <tr align="center"><td colspan="2"><input type="button" name="AdminAddStu_xxd" value="&nbsp;&nbsp;&nbsp;&nbsp;安全退出系统&nbsp;&nbsp;&nbsp;&nbsp;"
  οnclick="window.location.href='AdminService_xxd?act=exist'"/></td></tr>

  <tr>
  <td align="center"><a href="AdminMain_xxd.jsp" class="clj">返回上一页</a></td>
  <td align="center"><a href="main_xxd.jsp" class="clj">返回主页面</a></td>
  </tr>
  </table>
  </center>
 
  </body>
</html>

3.管理员添加学生信息页面

在这里插入图片描述
AdminAddStu_xxd.jsp

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'AdminAddStu_xxd.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<style type="text/css">
		body{
	background-image:url(images/nj03.jpg);
	font-family:幼圆;
	color: white;
	}
	body .bs{
	color: white;
	
	}
	.bg{
	margin-top: 80;
	}
	table .clj{
	color: white;
	text-decoration: none;
	}
	table .clj:HOVER{
	color: yellow;
	text-decoration: underline;
	}
</style>
  </head>
  
   <script type="text/javascript">
	function check(form1) {
		if (form1.Sname_xxd.value == "") {
			alert("用户名不能为空");
			form1.Sname_xxd.focus();
			return false;
		}

		if (form1.Spwd_xxd.value == "") {
			alert("密码不能为空");
			form1.Spwd_xxd.focus();
			return false;
		}

		if (form1.Spwd1_xxd.value == "") {
			alert("确认密码不能为空");
			form1.Spwd1_xxd.focus();
			return false;
		}

		if (form1.Spwd_xxd.value != form1.Spwd1_xxd.value) {
			alert("两次密码不一致");
			form1.Spwd_xxd.focus();
			return false;
			}
		if (form1.Sbrith_xxd.value == "") {
			alert("出生年月不能为空");
			form1.Sbrith_xxd.focus();
			return false;
		}
		if (form1.Stell_xxd.value == "") {
			alert("联系电话不能为空");
			form1.Stell_xxd.focus();
			return false;
		}		
		if (form1.Saddress_xxd.value == "") {
			alert("家庭住址不能为空");
			form1.Saddress_xxd.focus();
			return false;
		}	
		if (form1.Sanswer_xxd.value == "") {
			alert("密码找回答案不能为空");
			form1.Sanswer_xxd.focus();
			return false;
		}	
	}

</script>
<%
	String Sname_xxd = (String) session.getAttribute("Sname_xxd");
	if (Sname_xxd == null || "".equals(Sname_xxd)) {
		Sname_xxd = "";
	}
%>
  <body>
  <form name="form1" method="post" action="AdminService_xxd?act=addstu"
		οnsubmit="return check(this)">
		<table width="700" align="center" border="2" class="bg">
			<tr align="center">
				<td colspan="2" class="bs"><b>添加学生信息表</b></td>
			</tr>
			<tr>
				<th width="213" scope="row" class="bs">用户名:</th>
				<td width="337"><label for="Sname_xxd"></label>
					<input type="text" name="Sname_xxd" id="Sname_xxd" value="<%=Sname_xxd%>"></td>
			</tr>
			
			<tr>
				<th scope="row" class="bs">密码:</th>
				<td><label for="Spwd_xxd"></label> <input type="password" name="Spwd_xxd"
					id="Spwd_xxd"></td>
			</tr>
			<tr>
				<th scope="row" class="bs">确认密码:</th>
				<td><label for="Spwd1_xxd"></label> <input type="password"
					name="Spwd1_xxd" id="Spwd1_xxd"></td>
			</tr>
			<tr>
				<th scope="row" class="bs">性别:</th>
				<td class="bs"><input type="radio" value="男" name="Sgender_xxd">男 <input
					type="radio" value="女" name="Sgender_xxd" checked="checked">女</td>
			</tr>
			<tr>
				<th class="bs">出生年月:</th>
				<td width="400"><input name="Sbrith_xxd" id="Sbrith_xxd">(例:1900-01-01)</td>
			</tr>
			<tr>
				<th class="bs">联系电话:</th>
				<td width="400"><input name="Stell_xxd" id="Stell_xxd"></td>
			</tr>
			<tr>
				<th class="bs">家庭住址:</th>
				<td width="400"><input name="Saddress_xxd" id="Saddress_xxd"></td>
			</tr>
			
			<tr>
				<th scope="row" class="bs">密码找回问题:</th>
				<td><select name="Squestion_xxd" size="1">
						<option value="你喜欢的颜色是" selected>你喜欢的颜色是</option>
						<option value="你喜欢的食物是">你喜欢的食物是</option>
						<option value="你的小学班主任是">你的小学班主任是</option>
						<option value="你的第一个项目是">你的第一个项目是</option>
				</select></td>
			</tr>
			<tr>
				<th scope="row" class="bs">密码找回答案:</th>
				<td><label for="Sanswer_xxd"></label> <input type="text"
					name="Sanswer_xxd" id="Sanswer_xxd"></td>
			</tr>
			
			<tr>
				<th scope="row" class="bs">备注:</th>
				<td><label for="Snote_xxd"></label> <textarea name="Snote_xxd"
						id="Snote_xxd" cols="40" rows="5"></textarea></td>
			</tr>
			<tr align="center">
				<td colspan="2"><input type="submit" name="btn1" value="提交">
					<input type="reset" name="btn2" value="重置 "><br>
				<br> <a href="Adminlogin_xxd.jsp" class="clj">返回</a></td>

			</tr>
		</table>

	</form>
  </body>
</html>

4.管理员操作学生信息页面
在这里插入图片描述
AdminModifyStu.jsp

<%@page import="com.xxd.entity.Student_xxd"%>
<%@page import="com.xxd.DaoImpl.StudentDaoImpl_xxd"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'AdminModifyStu_xxd.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<style>
		body{
		background-image:url(images/timg22.jpg); 
		font-family:幼圆;	
		}
	</style>
<script>
	function check1(form2){
		if(form2.Sname_xxd.value == ""){
			alert("学生姓名不能为空");
			form2.Sname_xxd.focus();
			return falsel;
			}
		}
		
	function check(form3){
		if(form3.Sid_xxd.value == ""){
			alert("学生学号不能为空");
			form3.Sid_xxd.focus();
			return false;
			}
		}
		function showForm() {
		var myradio = document.getElementsByName("queryStu_xxd");
		var div = document.getElementById("c").getElementsByTagName("div");
		for (var i = 0; i < div.length; i++) {
			if (myradio[i].checked) {
				div[i].style.display = "block";
			} else {
				div[i].style.display = "none";
			}
		}
	}
</script>
  </head>
    	 <body>
  	 <p>
	<div>
		<input type="radio" value="按学生名称查询" name="queryStu_xxd" checked="checked"
			οnclick="showForm()" />按学生名称查询 <input type="radio" value="按学生学号查询"
			name="queryStu_xxd" οnclick="showForm()">按学生学号查询
	</div>
	</p>
		<div id="c">
		<div class="c1">
			<form name="form2" method="post"
				action="StudentService_xxd?act=ModifyStuBySname"
				οnsubmit="return check1(form2)">
				学生名称:<input name="Sname_xxd"><input type="submit" value="提交"
					name="btn1">
			</form>
		</div>
		</p>
		<div class="c2" style="display:none;">
			<form name="form3" method="post"
				action="StudentService_xxd?act=ModifyStuBySid"
				οnsubmit="return check2(form3)">
				学生学号:<input name="Sid_xxd"><input type="submit" value="提交"
					name="btn1">
			</form>
		</div>
  </body>
  <%
 	List<Student_xxd> list = (List<Student_xxd>) session.getAttribute("studentList");
 	if(list == null || list.size() ==0){
  %>
  no student!
  <% 
  	}else{
  %>
  
  	<table width="1400" align="center" border="0" class="bg">
  	<tr>
  		<th>学号</th>
  		<th>姓名</th>
  		<th>密码</th>
  		<th width="80">性别</th>
  		<th>出生年月</th>
  		<th>联系电话</th>
  		<th>家庭住址</th>
  		<th>找回密码问题</th>
  		<th>找回密码答案</th>
  		<th>备注</th>
  		<th>操作</th>
  	</tr>
  	<%
  		for(Student_xxd s : list){
  	 %>
  	 <tr>
  	 <form name="form2" method="post" action="StudentService_xxd?act=AdminModifyStu">
  	 	<td><input name="Sid_xxd" value="<%=s.getSid_xxd()%>" style="height: 27px; width: 60px; " readonly="readonly"></td>
  	 	<td><input name="Sname_xxd" value="<%=s.getSname_xxd()%>" readonly="readonly"></td>
  	 	<td><input  name="Spwd_xxd" value="<%=s.getSpwd_xxd()%>" ></td>
  	 	<td>
					<%
						if (s.getSgender_xxd().equals("男")) {
					%> <input type="radio" value="男" name="Sgender_xxd" checked="checked">男
					<input type="radio" value="女" name="Sgender_xxd">女 <%
 	} else {
 %> <input type="radio" value="男" name="Sgender_xxd">男 <input
					type="radio" value="女" name="Sgender_xxd" checked="checked">女 <%
 	}
 %>
				</td>
  	 	<td><input name="Sbrith_xxd" value="<%=s.getSbrith_xxd() %>"></td>
  	 	<td><input name="Stell_xxd" value="<%=s.getStell_xxd() %>"></td>
  	 	<td><input name="Saddress_xxd" value="<%=s.getSaddress_xxd() %>"></td>
  	 	<td><select name="Squestion_xxd" size="1">
						<option value="你喜欢的颜色是" selected>你喜欢的颜色是</option>
						<option value="你喜欢的食物是">你喜欢的食物是</option>
						<option value="你的小学班主任是">你的小学班主任是</option>
						<option value="你的第一个项目是">你的第一个项目是</option>
				</select></td>
  	 	<td><input name="Sanswer_xxd" value="<%=s.getSanswer_xxd() %>"></td>
  	 	<td><input name="Snote_xxd" value="<%=s.getSnote_xxd() %>"></td>
  	 	<td><input type="submit" name="btn1" value="修改"><td><input type="button" name="studentStatus_xxd" value="学籍"
  	 	 οnclick="window.location.href='AdminService_xxd?act=AdminseleStaInfo&id='+<%=s.getSid_xxd()%>"><input type="button" value="删除"
  	 	 οnclick="window.location.href='StudentService_xxd?act=delstu&Sid_xxd='+<%=s.getSid_xxd()%>"></td>
  	 	 </form>
  	 </tr>
  	 <%
  	 	}
  	  %>
  	</table>
  	  	
  	<%
  		}	
  	 %>
  	 <table width="1000" align="center" border="0">
  	 <tr align="right">
  	 <td><br> <input type="button" value="刷新列表" name="btn2"
  	 οnclick="window.location.href='AdminService_xxd?act=queryAllStuInfo'"/></td>
				<td>
				<br> 
				<input type="button" name="btn1" value="退出查看"
			οnclick="window.location.href='Adminlogin_xxd.jsp'"/>
			</td>
			</tr>
  	</table>

</html>

5.管理员操作学生学籍信息
在这里插入图片描述
AdminModifySta.jsp

<%@page import="com.xxd.entity.Student_xxd"%>
<%@page import="com.xxd.DaoImpl.StudentDaoImpl_xxd"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'AdminModifyStu_xxd.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<style>
		body{
		background-image:url(images/timg22.jpg); 
		font-family:幼圆;	
		}
	</style>
<script>
	function check1(form2){
		if(form2.Sname_xxd.value == ""){
			alert("学生姓名不能为空");
			form2.Sname_xxd.focus();
			return falsel;
			}
		}
		
	function check(form3){
		if(form3.Sid_xxd.value == ""){
			alert("学生学号不能为空");
			form3.Sid_xxd.focus();
			return false;
			}
		}
		function showForm() {
		var myradio = document.getElementsByName("queryStu_xxd");
		var div = document.getElementById("c").getElementsByTagName("div");
		for (var i = 0; i < div.length; i++) {
			if (myradio[i].checked) {
				div[i].style.display = "block";
			} else {
				div[i].style.display = "none";
			}
		}
	}
</script>
  </head>
    	 <body>
  	 <p>
	<div>
		<input type="radio" value="按学生名称查询" name="queryStu_xxd" checked="checked"
			οnclick="showForm()" />按学生名称查询 <input type="radio" value="按学生学号查询"
			name="queryStu_xxd" οnclick="showForm()">按学生学号查询
	</div>
	</p>
		<div id="c">
		<div class="c1">
			<form name="form2" method="post"
				action="StudentService_xxd?act=ModifyStuBySname"
				οnsubmit="return check1(form2)">
				学生名称:<input name="Sname_xxd"><input type="submit" value="提交"
					name="btn1">
			</form>
		</div>
		</p>
		<div class="c2" style="display:none;">
			<form name="form3" method="post"
				action="StudentService_xxd?act=ModifyStuBySid"
				οnsubmit="return check2(form3)">
				学生学号:<input name="Sid_xxd"><input type="submit" value="提交"
					name="btn1">
			</form>
		</div>
  </body>
  <%
 	List<Student_xxd> list = (List<Student_xxd>) session.getAttribute("studentList");
 	if(list == null || list.size() ==0){
  %>
  no student!
  <% 
  	}else{
  %>
  
  	<table width="1400" align="center" border="0" class="bg">
  	<tr>
  		<th>学号</th>
  		<th>姓名</th>
  		<th>密码</th>
  		<th width="80">性别</th>
  		<th>出生年月</th>
  		<th>联系电话</th>
  		<th>家庭住址</th>
  		<th>找回密码问题</th>
  		<th>找回密码答案</th>
  		<th>备注</th>
  		<th>操作</th>
  	</tr>
  	<%
  		for(Student_xxd s : list){
  	 %>
  	 <tr>
  	 <form name="form2" method="post" action="StudentService_xxd?act=AdminModifyStu">
  	 	<td><input name="Sid_xxd" value="<%=s.getSid_xxd()%>" style="height: 27px; width: 60px; " readonly="readonly"></td>
  	 	<td><input name="Sname_xxd" value="<%=s.getSname_xxd()%>" readonly="readonly"></td>
  	 	<td><input  name="Spwd_xxd" value="<%=s.getSpwd_xxd()%>" ></td>
  	 	<td>
					<%
						if (s.getSgender_xxd().equals("男")) {
					%> <input type="radio" value="男" name="Sgender_xxd" checked="checked">男
					<input type="radio" value="女" name="Sgender_xxd">女 <%
 	} else {
 %> <input type="radio" value="男" name="Sgender_xxd">男 <input
					type="radio" value="女" name="Sgender_xxd" checked="checked">女 <%
 	}
 %>
				</td>
  	 	<td><input name="Sbrith_xxd" value="<%=s.getSbrith_xxd() %>"></td>
  	 	<td><input name="Stell_xxd" value="<%=s.getStell_xxd() %>"></td>
  	 	<td><input name="Saddress_xxd" value="<%=s.getSaddress_xxd() %>"></td>
  	 	<td><select name="Squestion_xxd" size="1">
						<option value="你喜欢的颜色是" selected>你喜欢的颜色是</option>
						<option value="你喜欢的食物是">你喜欢的食物是</option>
						<option value="你的小学班主任是">你的小学班主任是</option>
						<option value="你的第一个项目是">你的第一个项目是</option>
				</select></td>
  	 	<td><input name="Sanswer_xxd" value="<%=s.getSanswer_xxd() %>"></td>
  	 	<td><input name="Snote_xxd" value="<%=s.getSnote_xxd() %>"></td>
  	 	<td><input type="submit" name="btn1" value="修改"><td><input type="button" name="studentStatus_xxd" value="学籍"
  	 	 οnclick="window.location.href='AdminService_xxd?act=AdminseleStaInfo&id='+<%=s.getSid_xxd()%>"><input type="button" value="删除"
  	 	 οnclick="window.location.href='StudentService_xxd?act=delstu&Sid_xxd='+<%=s.getSid_xxd()%>"></td>
  	 	 </form>
  	 </tr>
  	 <%
  	 	}
  	  %>
  	</table>
  	  	
  	<%
  		}	
  	 %>
  	 <table width="1000" align="center" border="0">
  	 <tr align="right">
  	 <td><br> <input type="button" value="刷新列表" name="btn2"
  	 οnclick="window.location.href='AdminService_xxd?act=queryAllStuInfo'"/></td>
				<td>
				<br> 
				<input type="button" name="btn1" value="退出查看"
			οnclick="window.location.href='Adminlogin_xxd.jsp'"/>
			</td>
			</tr>
  	</table>

</html>

6.管理员添加学生学籍操作
在这里插入图片描述
AdminAddStuStatus.jsp

<%@page import="com.xxd.entity.Student_xxd"%>
<%@page import="com.xxd.DaoImpl.StudentDaoImpl_xxd"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'AdminAddStuStatus_xxd.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
 <style type="text/css">
 	body{
	background-image: url(images/timg4HBY6HZC.jpg);
	font-family:幼圆;
	background-repeat: no-repeat;
	background-position: center;
	} 
	body .bg{
	color: white;
	margin-top: 45;
}
	table .clj{
	color: black;
	text-decoration: none;
	}
	table .clj:HOVER{
	color: yellow;
	text-decoration: underline;
	}
 </style>
  </head>
    <script type="text/javascript">
	function check(form1) {
		if (form1.Xschool_xxd.value == "") {
			alert("学校不能为空");
			form1.Xschool_xxd.focus();
			return false;
		}

		if (form1.Xspecial_xxd.value == "") {
			alert("专业不能为空");
			form1.Xspecial_xxd.focus();
			return false;
		}

		if (form1.Xclass_xxd.value == "") {
			alert("班级不能为空");
			form1.Xclass_xxd.focus();
			return false;
		}
		if (form1.Xeducation_xxd.value == "") {
			alert("学历不能为空");
			form1.Xeducation_xxd.focus();
			return false;
		}
		if (form1.Xtotalcredit_xxd.value == "") {
			alert("总学分不能为空");
			form1.Xtotalcredit_xxd.focus();
			return false;
		}		
		if (form1.Xschoolyear_xxd.value == "") {
			alert("入学年月不能为空");
			form1.Xschoolyear_xxd.focus();
			return false;
		}		
	}
</script>
<%
	if (request.getSession().getAttribute("a") == null) {
		request.getRequestDispatcher("Adminlogin_xxd.jsp").forward(request,
				response);
	}
	long id = new StudentDaoImpl_xxd().checkstuId((String) session
	.getAttribute("a"));
%>
  <body>
  <form name="form1" method="post" action="AdminService_xxd?act=addstusta"
		οnsubmit="return check(this)">
		<table width="700" align="center" border="2" class="bg">
			<tr align="center">
				<td colspan="2"><b>添加学籍信息表</b></td>
			</tr>
			<tr style="display:none">
				<td>学生      ID:</td>
				<td><input name="id" value="<%=id%>" readonly="readonly"></td>
			</tr>
			
			<tr>
				<th scope="row">学校:</th>
				<td><label for="Xschool_xxd"></label> <input type="text" name="Xschool_xxd"
					id="Xschool_xxd"></td>
			</tr>
			<tr>
				<th scope="row">专业:</th>
				<td><label for="Xspecial_xxd"></label> <input type="text"
					name="Xspecial_xxd" id="Xspecial_xxd"></td>
			</tr>
			<tr>
				<th>班级:</th>
				<td width="400"><input type="text" name="Xclass_xxd" id="Xclass_xxd"></td>
			</tr>
			<tr>
				<th>学历:</th>
				<td width="400"><input type="text" name="Xeducation_xxd" id="Xeducation_xxd"></td>
			</tr>
			<tr>
				<th>总学分:</th>
				<td width="400"><input type="text" name="Xtotalcredit_xxd" id="Xtotalcredit_xxd"></td>
			</tr>
			<tr>
				<th>入学年月:</th>
				<td width="400"><input type="text" name="Xschoolyear_xxd" id="Xschoolyear_xxd">(例:1900-01-01)</td>
			</tr>
			
			
			<tr>
				<th scope="row">毕业年月:</th>
				<td><label for="Xgraduation_xxd"></label> <input type="text"
					name="Xgraduation_xxd" id="Xgraduation_xxd">(例:1900-01-01)</td>
			</tr>
			<tr align="center">
				<td colspan="2"><input type="submit" name="btn1" value="提交">
					<input type="reset" name="btn2" value="重置 "><br>
				<br> <a href="Adminlogin_xxd.jsp" class="clj">不注册学籍</a></td>

			</tr>
		</table>
	</form>
  </body>
</html>

1.学生登陆页面
在这里插入图片描述
StudentMain.jsp

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'StudentMain_xxd.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<style type="text/css">
	body{
	background-image: url(images/timg533.jpg);
	font-family:幼圆;
	}
	body .stu_main{
		margin-top: 150px;
	}
	
	.stu_main .zc {
	color: black;
	text-decoration: none;
}
	.stu_main .zc:HOVER{
	color: yellow;
	text-decoration: underline;
}
	
	</style>
  </head>
      <script type="text/javascript">
	http:
		function newCode() {
		var today = new Date();
		document.getElementById("imgNumber").src = "IdentityCodePicServ_xxd?tm="
				+ today.getTime();
		
	}
	function check(form1) {
		if (form1.useName_xxd.value == "") {
			alert("请输入用户名!");
			form1.useName_xxd.focus();
			return false;
		}
		if (form1.pwd_xxd.value == "") {
			alert("密码不能为空!");
			form1.pwd_xxd.focus();
			return false;
		}
	}
</script>

  <%
	String str = (String) request.getAttribute("Sname_xxd");
	if (str == null) {
		str = "";
	}
%>
  <body>
    <form method="post" action="StudentService_xxd?act=stuLogin" οnsubmit="return check(this)"
		name="from1">
		<table border="1" width="500" height="350" align="center" class="stu_main">
			<tr>
				<td colspan="2" align="center" class="zc"><h2>
						<b>学&nbsp;&nbsp;生&nbsp;&nbsp;登&nbsp;&nbsp;录&nbsp;&nbsp;页&nbsp;&nbsp;面</b>
					</h1></td>
			</tr>
		
			<tr>
				<td class="zc" align="center" width="130">用户名:</td>
				<td width="350"><input type="text" id="Sname_xxd"
					name="Sname_xxd" value="<%=str %>"  style="width: 320px; "></td>
			</tr>
			<tr>
				<td class="zc" align="center">用户密码:</td>
				<td><input type="password" name="Spwd_xxd" id="Spwd_xxd"
					style="width: 322px; "></td>
			</tr>
				<tr>
				<td>验证码:</td>
				<td><input  type="text" name="code_xxd" style="height: 28px; width: 80px; "/> <img
					src="IdentityCodePicServ_xxd" id="imgNumber" /> <a
					href="javascript:newCode()" class="zc">看不清,换一张</a></td>

			</tr>
			<tr>
				<td colspan="3" align="center"><a href ="StudentReg_xxd.jsp" class="zc">注册</a>&nbsp;&nbsp;<a href ="findpwd1_xxd.jsp" class="zc">找回密码</a>
			<tr>
				<td colspan="2" align="center">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" value="登录" id="btn1">&nbsp;&nbsp;&nbsp;<input type="reset" value="重置" id="btn2">&nbsp;
					<a href="main_xxd.jsp" class="zc">返回主页面</a></td>
			</tr>
		</table> 

	</form>
  </body>
</html>

2.学生注册页面
在这里插入图片描述
StudentReg.jsp

<%@page import="com.xxd.entity.Student_xxd"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'StudentReg_xxd.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<style type="text/css">
		body{
	background-image:url(images/nj03.jpg);
	font-family:幼圆;
	color: white;
	}
	body .bs{
	color: white;
	}
	.bg{
	margin-top: 60
	}
	table .clj{
	color: white;
	text-decoration: none;
	}
	table .clj:HOVER{
	color: yellow;
	text-decoration: underline;
	}
</style>
  </head>
  <script type="text/javascript">
	function check(form1) {
		if (form1.Sname_xxd.value == "") {
			alert("用户名不能为空");
			form1.Sname_xxd.focus();
			return false;
		}

		if (form1.Spwd_xxd.value == "") {
			alert("密码不能为空");
			form1.Spwd_xxd.focus();
			return false;
		}

		if (form1.Spwd1_xxd.value == "") {
			alert("确认密码不能为空");
			form1.Spwd1_xxd.focus();
			return false;
		}

		if (form1.Spwd_xxd.value != form1.Spwd1_xxd.value) {
			alert("两次密码不一致");
			form1.Spwd_xxd.focus();
			return false;
			}
		if (form1.Sbrith_xxd.value == "") {
			alert("出生年月不能为空");
			form1.Sbrith_xxd.focus();
			return false;
		}
		if (form1.Stell_xxd.value == "") {
			alert("联系电话不能为空");
			form1.Stell_xxd.focus();
			return false;
		}		
		if (form1.Saddress_xxd.value == "") {
			alert("家庭住址不能为空");
			form1.Saddress_xxd.focus();
			return false;
		}	
		if (form1.Sanswer_xxd.value == "") {
			alert("密码找回答案不能为空");
			form1.Sanswer_xxd.focus();
			return false;
		}	
	}

</script>
<%
	String Sname_xxd = (String) session.getAttribute("Sname_xxd");
	if (Sname_xxd == null || "".equals(Sname_xxd)) {
		Sname_xxd = "";
	}
%>
  <body>
  <form name="form1" method="post" action="StudentService_xxd?act=regstudent"
		οnsubmit="return check(this)">
		<table width="700" align="center" border="2" class="bg">
			<tr align="center">
				<td colspan="2" class="bs"><b>注册学生信息表</b></td>
			</tr>
			<tr>
				<th width="213" scope="row" class="bs">用户名:</th>
				<td width="337"><label for="Sname_xxd"></label>
					<input type="text" name="Sname_xxd" id="Sname_xxd" value="<%=Sname_xxd%>"></td>
			</tr>
			
			<tr>
				<th scope="row" class="bs">密码:</th>
				<td><label for="Spwd_xxd"></label> <input type="password" name="Spwd_xxd"
					id="Spwd_xxd"></td>
			</tr>
			<tr>
				<th scope="row" class="bs">确认密码:</th>
				<td><label for="Spwd1_xxd"></label> <input type="password"
					name="Spwd1_xxd" id="Spwd1_xxd"></td>
			</tr>
			<tr>
				<th scope="row" class="bs">性别:</th>
				<td class="bs"><input type="radio" value="男" name="Sgender_xxd">男 <input
					type="radio" value="女" name="Sgender_xxd" checked="checked">女</td>
			</tr>
			<tr>
				<th class="bs">出生年月:</th>
				<td width="400"><input name="Sbrith_xxd" id="Sbrith_xxd">(例:1900-01-01)</td>
			</tr>
			<tr>
				<th class="bs">联系电话:</th>
				<td width="400"><input name="Stell_xxd" id="Stell_xxd"></td>
			</tr>
			<tr>
				<th class="bs">家庭住址:</th>
				<td width="400"><input name="Saddress_xxd" id="Saddress_xxd"></td>
			</tr>
			
			<tr>
				<th scope="row" class="bs">密码找回问题:</th>
				<td><select name="Squestion_xxd" size="1">
						<option value="你喜欢的颜色是" selected>你喜欢的颜色是</option>
						<option value="你喜欢的食物是">你喜欢的食物是</option>
						<option value="你的小学班主任是">你的小学班主任是</option>
						<option value="你的第一个项目是">你的第一个项目是</option>
				</select></td>
			</tr>
			<tr>
				<th scope="row" class="bs">密码找回答案:</th>
				<td><label for="Sanswer_xxd"></label> <input type="text"
					name="Sanswer_xxd" id="Sanswer_xxd"></td>
			</tr>
			
			<tr>
				<th scope="row" class="bs">备注:</th>
				<td><label for="Snote_xxd"></label> <textarea name="Snote_xxd"
						id="Snote_xxd" cols="40" rows="5"></textarea></td>
			</tr>
			<tr align="center">
				<td colspan="2"><input type="submit" name="btn1" value="提交">
					<input type="reset" name="btn2" value="重置 "><br>
				<br> <a href="StudentMain_xxd.jsp" class="clj">返回</a></td>

			</tr>
		</table>

	</form>
  </body>
</html>

3.学生找回密码1
(这里不显示页面,为简单的输入框,具备功能效果)
findpwd1.jsp

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'findpwd1_xxd.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  <script type="text/javascript">
	function check(form1) {
		if (form1.Sname_xxd.value == "") {
			alert("用户名不能为空");
			form1.Sname_xxd.focus();
			return false;
		}
	}
</script>
  <body>
	<form name="form1" method="post" action="StudentService_xxd?act=findPwd1"
		οnsubmit="return check(this)">
		请输入你要找回密码的用户名:<input name="Sname_xxd" id="Sname_xxd"><input
			type="submit" value="提交" name="btn1">&nbsp;&nbsp;<a href ="StudentReg_xxd.jsp">注册</a>&nbsp;&nbsp;<a href ="StudentMain_xxd.jsp">登录</a>
	</form>
</body>
</html>

4.学生找回密码2
findpwd2.jsp

<%@page import="com.xxd.entity.Student_xxd"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'findpwd2_xxd.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  <script type="text/javascript">
	function check(form1) {
		if (form1.Sanswer.value == "") {
			alert("答案不能为空");
			form1.Sanswer.focus();
			return false;
		}
	}
</script>
<%
	Student_xxd s = (Student_xxd) session.getAttribute("stu");
%>
 <form name="form1" method="post" action="StudentService_xxd?act=findPwd2" οnsubmit="return check(this)">
	密码找回问题:<input readonly="readonly" name="Squestion_xxd"
		value="<%=s.getSquestion_xxd()%>"><br> 密码找回答案:<input
		name="Sanswer_xxd" id="Sanswer_xxd"> <input value="提交" type="submit"
		name="btn1">&nbsp;&nbsp;<a href ="StudentReg_xxd.jsp">注册</a>&nbsp;&nbsp;<a href ="StudentMain_xxd.jsp">登录</a>

</form>
</html>

5.学生找回密码3
findpwd3.jsp

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'findpwd3_xxd.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  <script type="text/javascript">
	function check(form1) {
		if (form1.Spwd_xxd.value == "") {
			alert("密码不能为空");
			form1.Spwd_xxd.focus();
			return false;
		}
		if (form1.Spwd1_xxd.value == "") {
			alert("再次输入密码不能为空");
			form1.Spwd1_xxd.focus();
			return false;
		}
		if (form1.Spwd_xxd.value != form1.Spwd1_xxd.value) {
			alert("两次密码输入不一致");
			form1.Spwd_xxd.focus();
			return false;
		}
	}
</script>
  <body>
    <form name="form1" method="post" action="StudentService_xxd?act=findPwd3"
		οnsubmit="return check(this)">
		请输入新密码: <input type="password" name="Spwd_xxd"> <br>
		请再次输入新密码: <input type="password" name="Spwd1_xxd"> <br> <input
			type="submit" value="提交" name="btn1"> <input type="reset"
			value="重置" name="btn2">
	</form>
  </body>
</html>

6.学生功能页面
在这里插入图片描述
Stulogin.jsp

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'Stulogin_xxd.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<style>
	body{
	background-image: url(images/timg4HBY6HZC.jpg);
	font-family:幼圆;
	background-repeat: no-repeat;
	background-position: center;
	}
	body .bg_xxd{
		margin-top: 35px;
	}
	body .bs{
	color: white;
	}
 .bg_xxd a{
	text-decoration: none;
	color:white;
}
 .bg_xxd a:HOVER {
	text-decoration: underline;
	color:yellow;
}
</style>
  </head>
  
  <body>
  <center>
  <div>&nbsp;</div>
   <div>&nbsp;</div>
    <div>&nbsp;</div>
  学生:<%=session.getAttribute("a")%>
	欢迎登录!<br>
  <table border="2" height="400" width="450" class="bg_xxd">
  <tr align="center"><h3><th colspan="2" class="bs">请选择需要使用的功能!</th></tr>
  <tr align="center" ><td colspan="2"><input type="button" name="addStuStatusInfo_xxd" value="填写学籍信息"
  οnclick="window.location.href='StudentStatusServ_xxd?act=getStuStacountInfo'"/></td></tr>
    <tr align="center"><td colspan="2"><input type="button" name="selectStuInfo_xxd" value="查询个人信息"
  οnclick="window.location.href='StudentService_xxd?act=selectStuAndStatusInfo'"/></td></tr>
  <tr align="center"><td colspan="2"><input type="button" name="stuModifypwd_xxd" value="修改个人密码"
  οnclick="window.location.href='stuModifypwd_xxd.jsp'"/></td></tr>
  <tr align="center"><td colspan="2"><input type="button" name="stuModifyInfo_xxd" value="修改个人信息"
  οnclick="window.location.href='StudentService_xxd?act=getStuInfo'"/></td></tr>
  <tr align="center"><td colspan="2"><input type="button" name="stuStatusModifyInfo_xxd" value="修改学籍信息"
  οnclick="window.location.href='StudentStatusServ_xxd?act=getStuStaInfo'"/></td></tr>
  <tr align="center"><td colspan="2"><input type="button" name="stuStatusModifyInfo_xxd" value="安全退出系统"
  οnclick="window.location.href='StudentService_xxd?act=exist'"/></td></tr>
  <tr>
  <tr>
  <td align="center" ><a href="StudentMain_xxd.jsp">返回上一页</a></td>
  <td align="center"><a href="main_xxd.jsp">返回主页面</a></td>
  </tr>
  
  </table>
  </center>
  </body>
</html>

7.学生填写学籍信息页面
在这里插入图片描述

addStuStatusInfo.jsp

<%@page import="com.xxd.entity.Student_xxd"%>
<%@page import="com.xxd.DaoImpl.StudentDaoImpl_xxd"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'addStuStatusInfo_xxd.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
 <style type="text/css">
 	body{
	background-image: url(images/timg4HBY6HZC.jpg);
	font-family:幼圆;
	background-repeat: no-repeat;
	background-position: center;
	} 
	body .bg{
	color: white;
	margin-top: 45;
}
	table .clj{
	color: black;
	text-decoration: none;
	}
	table .clj:HOVER{
	color: yellow;
	text-decoration: underline;
	}
 </style>
  </head>
    <script type="text/javascript">
	function check(form1) {
		if (form1.Xschool_xxd.value == "") {
			alert("学校不能为空");
			form1.Xschool_xxd.focus();
			return false;
		}

		if (form1.Xspecial_xxd.value == "") {
			alert("专业不能为空");
			form1.Xspecial_xxd.focus();
			return false;
		}

		if (form1.Xclass_xxd.value == "") {
			alert("班级不能为空");
			form1.Xclass_xxd.focus();
			return false;
		}
		if (form1.Xeducation_xxd.value == "") {
			alert("学历不能为空");
			form1.Xeducation_xxd.focus();
			return false;
		}
		if (form1.Xtotalcredit_xxd.value == "") {
			alert("总学分不能为空");
			form1.Xtotalcredit_xxd.focus();
			return false;
		}		
		if (form1.Xschoolyear_xxd.value == "") {
			alert("入学年月不能为空");
			form1.Xschoolyear_xxd.focus();
			return false;
		}		
	}
</script>
<%
	if (request.getSession().getAttribute("a") == null) {
		request.getRequestDispatcher("main_xxd.jsp").forward(request,
				response);
	}
	long id = new StudentDaoImpl_xxd().checkstuId((String) session
	.getAttribute("a"));
%>
  <body>
  <form name="form1" method="post" action="StudentStatusServ_xxd?act=addstusta"
		οnsubmit="return check(this)">
		<table width="700" align="center" border="2" class="bg">
			<tr align="center">
				<td colspan="2"><b>添加学籍信息表</b></td>
			</tr>
			<tr style="display:none">
				<td>学生      ID:</td>
				<td><input name="id" value="<%=id%>" readonly="readonly"></td>
			</tr>
			
			<tr>
				<th scope="row">学校:</th>
				<td><label for="Xschool_xxd"></label> <input type="text" name="Xschool_xxd"
					id="Xschool_xxd"></td>
			</tr>
			<tr>
				<th scope="row">专业:</th>
				<td><label for="Xspecial_xxd"></label> <input type="text"
					name="Xspecial_xxd" id="Xspecial_xxd"></td>
			</tr>
			<tr>
				<th>班级:</th>
				<td width="400"><input type="text" name="Xclass_xxd" id="Xclass_xxd"></td>
			</tr>
			<tr>
				<th>学历:</th>
				<td width="400"><input type="text" name="Xeducation_xxd" id="Xeducation_xxd"></td>
			</tr>
			<tr>
				<th>总学分:</th>
				<td width="400"><input type="text" name="Xtotalcredit_xxd" id="Xtotalcredit_xxd"></td>
			</tr>
			<tr>
				<th>入学年月:</th>
				<td width="400"><input type="text" name="Xschoolyear_xxd" id="Xschoolyear_xxd">&nbsp;&nbsp;(例:1900-01-01)</td>
			</tr>
			
			
			<tr>
				<th scope="row">毕业年月:</th>
				<td><label for="Xgraduation_xxd"></label> <input type="text"
					name="Xgraduation_xxd" id="Xgraduation_xxd">&nbsp;&nbsp;(例:1900-01-01)</td>
			</tr>
			<tr align="center">
				<td colspan="2"><input type="submit" name="btn1" value="提交">
					<input type="reset" name="btn2" value="重置 "><br>
				<br> <a href="Stulogin_xxd.jsp" class="clj">返回</a></td>

			</tr>
		</table>
	</form>
  </body>
</html>


8.学生查询个人页面
x
selectStuInfo.jsp

<%@page import="com.xxd.entity.Student_xxd"%>
<%@page import="com.xxd.entity.StudentStatus_xxd"%>
<%@page import="com.xxd.DaoImpl.StudentDaoImpl_xxd"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'selectStuInfo_xxd.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<%
	Student_xxd s = (Student_xxd) request.getAttribute("s");
 %>
   <%
	StudentStatus_xxd x = (StudentStatus_xxd) request.getAttribute("t");
 %>
 <style>
 	body{
 	background-image: url(images/timg4HBY6HZC.jpg);
 	font-family:幼圆;
 	background-repeat: no-repeat;
 	background-position: center;
 	}
 	body .zgbk{
 	margin-top: 180;
 	}
 </style>
  </head>
  <%
	if (request.getSession().getAttribute("a") == null) {
		request.getRequestDispatcher("main_xxd.jsp").forward(request,
				response);
	}
	long Xid1_xxd = new StudentDaoImpl_xxd().checkstuId((String) session
	.getAttribute("a"));
%>  

  <body>
   <table width="1200" align="center" border="2" align="center" class="zgbk">
			<tr>
			<td>
			<table width="700"  align="left" border="0">
			<tr align="center">
				<td colspan="2"><b>学生信息</b></td>
			</tr>
			<tr>
				<th width="213" scope="row">用户名:</th>
				<td width="337"><label for="Sname_xxd"></label>
					<input type="text" name="Sname_xxd" id="Sname_xxd" readonly="readonly" value="<%=s.getSname_xxd()%>" readonly="readonly"></td>
			</tr>
			<tr>
				<th scope="row">性别:</th>
				<td>
					<%
						if (s.getSgender_xxd().equals("女")) {
					%> <input type="radio" value="男" name="Sgender_xxd">男 <input
					type="radio" value="女" name="Sgender_xxd" checked="checked">女 <%
 	} else {
 %> <input type="radio" value="男" name="Sgender_xxd" checked="checked">男
					<input type="radio" value="女" name="Sgender_xxd">女 <%
 	}
 %>
				</td>
			</tr>
			<tr>
				<th>出生年月:</th>
				<td width="400"><input name="Sbrith_xxd" id="Sbrith_xxd" value="<%=s.getSbrith_xxd()%>" readonly="readonly"></td>
			</tr>
			<tr>
				<th>联系电话:</th>
				<td width="400"><input name="Stell_xxd" id="Stell_xxd" value="<%=s.getStell_xxd()%>" readonly="readonly"></td>
			</tr>
			<tr>
				<th>家庭住址:</th>
				<td width="400"><input name="Saddress_xxd" id="Saddress_xxd" value="<%=s.getSaddress_xxd()%>" readonly="readonly"></td>
			</tr>
			
			<tr>
				<th scope="row" >密码找回问题:</th>
				<td><select name="Squestion_xxd" size="1" >
						<option value="你喜欢的颜色是" selected>你喜欢的颜色是</option>
						<option value="你喜欢的食物是">你喜欢的食物是</option>
						<option value="你的小学班主任是">你的小学班主任是</option>
						<option value="你的第一个项目是">你的第一个项目是</option>
				</select></td>
			</tr>
			<tr>
				<th scope="row">密码找回答案:</th>
				<td><label for="Sanswer_xxd"></label> <input type="text"
					name="Sanswer_xxd" id="Sanswer_xxd" value="<%=s.getSanswer_xxd()%>" readonly="readonly"></td>
			</tr>
			
			<tr>
				<th scope="row">备注:</th>
				<td><label for="Snote_xxd"></label> <textarea name="Snote_xxd"
						id="Snote_xxd"cols="40" rows="5" readonly="readonly"><%=s.getSnote_xxd()%></textarea></td>
			</tr>
			
		</table>
			</td>
			<td>
			<table width="700" align="right" border="0">
			<tr align="center">
				<td colspan="2"><b>个人学籍信息</b></td>
			</tr>
			<tr style="display:none">
				<td >学生ID:</td>
				<td><input name="Xid1_xxd" id="Xid1_xxd" value="<%=Xid1_xxd%>" readonly="readonly"></td>
			</tr>
			
			<tr>
				<th scope="row">学校:</th>
				<td><label for="Xschool_xxd"></label> 
				<input type="text" name="Xschool_xxd"id="Xschool_xxd" value="<%=x.getXschool_xxd()%>" readonly="readonly">
				</td>
			</tr>
			
			<tr>
				<th scope="row">专业:</th>
				<td><label for="Xspecial_xxd"></label> <input type="text"
					name="Xspecial_xxd" id="Xspecial_xxd" value="<%=x.getXspecial_xxd()%>" readonly="readonly"></td>
			</tr>
			<tr>
				<th>班级:</th>
				<td width="400"><input type="text" name="Xclass_xxd" id="Xclass_xxd" value="<%=x.getXclass_xxd()%>" readonly="readonly"></td>
			</tr>
			<tr>
				<th>学历:</th>
				<td width="400"><input type="text" name="Xeducation_xxd" id="Xeducation_xxd" value="<%=x.getXeducation_xxd()%>" readonly="readonly"></td>
			</tr>
			<tr>
				<th>总学分:</th>
				<td width="400"><input type="text" name="Xtotalcredit_xxd" id="Xtotalcredit_xxd" value="<%=x.getXtotalcredit_xxd()%>" readonly="readonly"></td>
			</tr>
			<tr>
				<th>入学年月:</th>
				<td width="400"><input type="text" name="Xschoolyear_xxd" id="Xschoolyear_xxd" value="<%=x.getXschoolyear_xxd()%>" readonly="readonly"></td>
			</tr>
			
			
			<tr>
				<th scope="row">毕业年月:</th>
				<td><label for="Xgraduation_xxd"></label> <input type="text"
					name="Xgraduation_xxd" id="Xgraduation_xxd" value="<%=x.getXgraduation_xxd()%>" readonly="readonly"></td>
			</tr>
			<tr align="center">
				<td colspan="2">
				<br> 
			</tr>
			<tr align="right"><td colspan="2"><input type="button" name="selectStuInfo_xxd" value="退出查看"
  οnclick="window.location.href='Stulogin_xxd.jsp'"/></td></tr>
		</table>
			</td>	
			</tr>
		</table>

  </body>
</html>

9.学生修改账号密码页面
在这里插入图片描述
stuModifypwd.jsp

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'stuModifypwd_xxd.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<style type="text/css">
 	body{
	background-image: url(images/timg4HBY6HZC.jpg);
	font-family:幼圆;
	background-repeat: no-repeat;
	background-position: center;
	} 
		body .bg{
	color: white;
	margin-top: 150;
}
	table .clj{
	color: black;
	text-decoration: none;
	}
	table .clj:HOVER{
	color: yellow;
	text-decoration: underline;
	}
</style>
  </head>
<script type="text/javascript">
	function check(from1) {
		if (form1.Spwd_xxd.value == "") {
			alert("原密码不能为空");
			form1.Spwd_xxd.focus();
			return false;
		}
		if (form1.Spwd1_xxd.value == "") {
			alert("新密码不能为空");
			form1.Spwd1_xxd.focus();
			return false;
		}
		if (form1.Spwd2_xxd.value == "") {
			alert("再次新密码不能为空");
			form1.Spwd2_xxd.focus();
			return false;
		}
		if (form1.Spwd1_xxd.value != form1.Spwd2_xxd.value) {
			alert("两次新密码不一致!");
			form1.Spwd1_xxd.focus();
			return false;
		}
	}
</script>
<body>
	<form name="form1" method="post" action="StudentService_xxd?act=modPwd"
		οnsubmit="return check(this)">
		<table width="700" border="1" align="center" class="bg">
			<tr>
				<th colspan="2" align="center">修改学生个人密码</th>
			</tr>
			<tr>
				<td width="100">原密码:</td>
				<td><input type="password" name="Spwd_xxd"></td>
			</tr>
			<tr>
				<td>新密码:</td>
				<td><input type="password" name="Spwd1_xxd"></td>
			</tr>
			<tr>
				<td>再次新密码:</td>
				<td><input type="password" name="Spwd2_xxd"></td>
			</tr>
			<tr>
				<td colspan="2"><input type="submit" value="提交" name="btn1">
					<input type="reset" value="重复"  name="btn2">&nbsp;&nbsp;&nbsp;<a class="clj" href="Stulogin_xxd.jsp">返回</a></td>

			</tr>
		</table>
	</form>

</body>
</html>

10.学生修改个人信息页面
在这里插入图片描述
stuModifyInfo.jsp

<%@page import="com.xxd.entity.Student_xxd"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'stuModifyInfo_xxd.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<%
	Student_xxd s = (Student_xxd) request.getAttribute("s");
 %>
 <style>
	body{
	background-image: url(images/timg4HBY6HZC.jpg);
	font-family:幼圆;
	background-repeat: no-repeat;
	background-position: center;
	} 
	body .bg{
	color: white;
	margin-top: 150;
}
	table .clj{
	color: black;
	text-decoration: none;
	}
	table .clj:HOVER{
	color: yellow;
	text-decoration: underline;
	}
 </style>
  </head>
  <script type="text/javascript">
	function check(form1) {
		if (form1.Sname_xxd.value == "") {
			alert("用户名不能为空");
			form1.Sname_xxd.focus();
			return false;
		}

		
		if (form1.Sbrith_xxd.value == "") {
			alert("出生年月不能为空");
			form1.Sbrith_xxd.focus();
			return false;
		}
		if (form1.Stell_xxd.value == "") {
			alert("联系电话不能为空");
			form1.Stell_xxd.focus();
			return false;
		}		
		if (form1.Saddress_xxd.value == "") {
			alert("家庭住址不能为空");
			form1.Saddress_xxd.focus();
			return false;
		}	
		if (form1.Sanswer_xxd.value == "") {
			alert("密码找回答案不能为空");
			form1.Sanswer_xxd.focus();
			return false;
		}	
	}

</script>
  <body >
    <form name="form1" method="post" action="StudentService_xxd?act=updateStuInfo"
		οnsubmit="return check(this)">
		<table width="700" align="center" border="2" class="bg">
			<tr align="center">
				<td colspan="2"><b>修改学生个人信息表</b></td>
			</tr>
			<tr>
				<th width="213" scope="row">用户名:</th>
				<td width="337"><label for="Sname_xxd"></label>
					<input type="text" name="Sname_xxd" id="Sname_xxd" readonly="readonly" value="<%=s.getSname_xxd()%>"></td>
			</tr>
			<tr>
				<th scope="row">性别:</th>
				<td>
					<%
						if (s.getSgender_xxd().equals("女")) {
					%> <input type="radio" value="男" name="Sgender_xxd">男 <input
					type="radio" value="女" name="Sgender_xxd" checked="checked">女 <%
 	} else {
 %> <input type="radio" value="男" name="Sgender_xxd" checked="checked">男
					<input type="radio" value="女" name="Sgender_xxd">女 <%
 	}
 %>
				</td>
			</tr>
			<tr>
				<th>出生年月:</th>
				<td width="400"><input name="Sbrith_xxd" id="Sbrith_xxd" value="<%=s.getSbrith_xxd()%>">(例:1900-01-01)</td>
			</tr>
			<tr>
				<th>联系电话:</th>
				<td width="400"><input name="Stell_xxd" id="Stell_xxd" value="<%=s.getStell_xxd()%>"></td>
			</tr>
			<tr>
				<th>家庭住址:</th>
				<td width="400"><input name="Saddress_xxd" id="Saddress_xxd" value="<%=s.getSaddress_xxd()%>"></td>
			</tr>
			
			<tr>
				<th scope="row">密码找回问题:</th>
				<td><select name="Squestion_xxd" size="1">
						<option value="你喜欢的颜色是" selected>你喜欢的颜色是</option>
						<option value="你喜欢的食物是">你喜欢的食物是</option>
						<option value="你的小学班主任是">你的小学班主任是</option>
						<option value="你的第一个项目是">你的第一个项目是</option>
				</select></td>
			</tr>
			<tr>
				<th scope="row">密码找回答案:</th>
				<td><label for="Sanswer_xxd"></label> <input type="text"
					name="Sanswer_xxd" id="Sanswer_xxd" value="<%=s.getSanswer_xxd()%>"></td>
			</tr>
			
			<tr>
				<th scope="row">备注:</th>
				<td><label for="Snote_xxd"></label> <textarea name="Snote_xxd"
						id="Snote_xxd"cols="40" rows="5" ><%=s.getSnote_xxd()%></textarea></td>
			</tr>
			<tr align="center">
				<td colspan="2"><input type="submit" name="btn1" value="提交">
					<input type="reset" name="btn2" value="重置 "><br>
				<br> <a href="Stulogin_xxd.jsp" class="clj">返回</a></td>

			</tr>
		</table>

	</form>
  </body>
</html>

11.学生修改个人学籍信息页面
在这里插入图片描述
stuStatusModifyInfo.jsp

<%@page import="com.xxd.entity.StudentStatus_xxd"%>
<%@page import="com.xxd.DaoImpl.StudentDaoImpl_xxd"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'stuStatusModifyInfo_xxd.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
  <%
	StudentStatus_xxd x = (StudentStatus_xxd) request.getAttribute("t");
 %>
 <style type="text/css">
 	body{
	background-image: url(images/timg4HBY6HZC.jpg);
	font-family:幼圆;
	background-repeat: no-repeat;
	background-position: center;
	} 
	body .bg{
	color: white;
	margin-top: 100;
}
	table .clj{
	color: black;
	text-decoration: none;
	}
	table .clj:HOVER{
	color: yellow;
	text-decoration: underline;
	}
 </style>
  </head>
   <script type="text/javascript">
	function check(form1) {
		if (form1.Xschool_xxd.value == "") {
			alert("学校不能为空");
			form1.Xschool_xxd.focus();
			return false;
		}

		if (form1.Xspecial_xxd.value == "") {
			alert("专业不能为空");
			form1.Xspecial_xxd.focus();
			return false;
		}

		if (form1.Xclass_xxd.value == "") {
			alert("班级不能为空");
			form1.Xclass_xxd.focus();
			return false;
		}
		if (form1.Xeducation_xxd.value == "") {
			alert("学历不能为空");
			form1.Xeducation_xxd.focus();
			return false;
		}
		if (form1.Xtotalcredit_xxd.value == "") {
			alert("总学分不能为空");
			form1.Xtotalcredit_xxd.focus();
			return false;
		}		
		if (form1.Xschoolyear_xxd.value == "") {
			alert("入学年月不能为空");
			form1.Xschoolyear_xxd.focus();
			return false;
		}		
	}
</script>
<%
	if (request.getSession().getAttribute("a") == null) {
		request.getRequestDispatcher("main_xxd.jsp").forward(request,
				response);
	}
	long Xid1_xxd = new StudentDaoImpl_xxd().checkstuId((String) session
	.getAttribute("a"));
%>  
  <body>
    <form name="form1" method="post" action="StudentStatusServ_xxd?act=updateStuStaInfo"
		οnsubmit="return check(this)">
		<table width="700" align="center" border="2" class="bg">
			<tr align="center">
				<td colspan="2"><b>修改个人学籍信息表</b></td>
			</tr>
			<tr style="display:none">
				<td >学生ID:</td>
				<td><input name="Xid1_xxd" id="Xid1_xxd" value="<%=Xid1_xxd%>" readonly="readonly"></td>
			</tr>
			
			<tr>
				<th scope="row">学校:</th>
				<td><label for="Xschool_xxd"></label> 
				<input type="text" name="Xschool_xxd"id="Xschool_xxd" value="<%=x.getXschool_xxd()%>">
				</td>
			</tr>
			
			<tr>
				<th scope="row">专业:</th>
				<td><label for="Xspecial_xxd"></label> <input type="text"
					name="Xspecial_xxd" id="Xspecial_xxd" value="<%=x.getXspecial_xxd()%>"></td>
			</tr>
			<tr>
				<th>班级:</th>
				<td width="400"><input type="text" name="Xclass_xxd" id="Xclass_xxd" value="<%=x.getXclass_xxd()%>"></td>
			</tr>
			<tr>
				<th>学历:</th>
				<td width="400"><input type="text" name="Xeducation_xxd" id="Xeducation_xxd" value="<%=x.getXeducation_xxd()%>"></td>
			</tr>
			<tr>
				<th>总学分:</th>
				<td width="400"><input type="text" name="Xtotalcredit_xxd" id="Xtotalcredit_xxd" value="<%=x.getXtotalcredit_xxd()%>"></td>
			</tr>
			<tr>
				<th>入学年月:</th>
				<td width="400"><input type="text" name="Xschoolyear_xxd" id="Xschoolyear_xxd" value="<%=x.getXschoolyear_xxd()%>">(例:1900-01-01)</td>
			</tr>
			
			
			<tr>
				<th scope="row">毕业年月:</th>
				<td><label for="Xgraduation_xxd"></label> <input type="text"
					name="Xgraduation_xxd" id="Xgraduation_xxd" value="<%=x.getXgraduation_xxd()%>">(例:1900-01-01)</td>
			</tr>
			<tr align="center">
				<td colspan="2"><input type="submit" name="btn1" value="提交">
					<input type="reset" name="btn2" value="重置 "><br>
				<br> <a href="Stulogin_xxd.jsp" class="clj">返回</a></td>

			</tr>
		</table>
	</form>
  </body>
</html>

总结

由于该项目是我一年前做的很多功能界面都不够完善,自己也是想着把最先开始的项目记录下来给了自己回顾知识点,该项目运用JSP技术,实现各个操作类的增删改查功能,页面设计比较简陋,但功能齐全,大家参考时也可以根据自己的要求进行修改,在尝试运行这个代码时遇到的问题也可以给我留言评论,如果我上线后看到也会及时的回复!

觉得我这篇文章对你有帮助,那么请给我点一个赞,您的小小鼓励,是我在敲码路上的大大动力!!!

  • 8
    点赞
  • 79
    收藏
    觉得还不错? 一键收藏
  • 6
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值