servlet+mysql实现的学生评教系统(角色:学生、教师、管理员 功能:评教、修改密码、评教规则管理、评教结果查看、学生管理、教师管理、班级管理、学生信息、评教结果可视化展示等)

servlet+mysql实现的学生评教系统

本系统学生评教的管理,分为学生、教师、管理员三种角色,功能包括评教、评教规则管理、评教结果可视化展示、学生管理、班级管理、教师管理、学生信息查看等。

实现功能截图

登录
请添加图片描述
评教
请添加图片描述
学生基本信息
请添加图片描述
评教成功
请添加图片描述
学生首次登录修改密码
请添加图片描述

教师登录首页
请添加图片描述
课程管理
请添加图片描述
教师管理
请添加图片描述
学生管理
请添加图片描述
评教结果管理
请添加图片描述
评教规则管理
请添加图片描述
已评教数据展示
请添加图片描述
请添加图片描述

使用技术

数据库:mysql
开发工具:Eclipse(Myeclispe、Idea也可以)
知识点:servlet/jsp

本系统采用将MVC的思想:将项目包分为pojo、dao/service/controller,代码结构清晰

实现的功能

一共分为三个角色
学生、教师、管理员

学生:
评教
首次登录修改密码
学生基本信息

教师
评教结果查看

管理员
评教规则管理
评教结果管理
课程管理
教师管理
学生管理

代码

dao

package com.home.dao;


import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;

import com.home.db.Conntion;
import com.home.pojo.Model_question;
import com.home.pojo.Model_score;
import com.home.pojo.Model_stu;
import com.home.pojo.Model_tea;
import com.sun.org.apache.xpath.internal.operations.Mod;



public class MyDao {
	static private Statement smt;
	static private Statement smt1;
	static private Statement smt2;
	static private ResultSet rs;
	static private ResultSet rs1;
	static private ResultSet rs2;
	static private Conntion dbc = null;
	//打开数据库连接
	public static void open(){
		
		try {
			dbc = new Conntion();
		} catch (Exception e1) {
			// TODO Auto-generated catch block
			System.out.print("连接失败!");
		}
		try {
			smt=dbc.getConnection().createStatement();
			smt1=dbc.getConnection().createStatement();
			smt2=dbc.getConnection().createStatement();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			System.out.print("创建连接失败");
		}
	}
	
	//关闭数据库连接
	static void close()
	{
		
			try {
				if(rs!=null)
				    rs.close();
				if(rs1!=null)
					rs1.close();
				if(rs2!=null)
					rs2.close();
				if(smt!=null)
					smt.close();
				if(smt1!=null)
					smt1.close();
				if(smt2!=null)
					smt2.close();
				if(dbc!=null)
					dbc.close();
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				System.out.print("关闭不正常,请联系管理员!!");
			}
		
	}
	
	//学生登录验证
	public static boolean stu_login(String sname,String spass){
		String sql="select * from s_user where s_id='"+sname+"' and s_password='"+spass+"'";
		open();
		try {
			rs=smt.executeQuery(sql);
			while(rs.next()){
				return true;
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			System.out.print("登陆失败!");
		}
		close();
		return false;
	}
	
	
	//教师登录验证
		public static boolean tea_login(String tname,String tpass){
			String sql="select * from t_user where t_id='"+tname+"' and t_password='"+tpass+"'";
			open();
			try {
				rs=smt.executeQuery(sql);
				while(rs.next()){
					return true;
				}
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				System.out.print("登陆失败!");
			}
			close();
			return false;
		}
		
		
		//管理员登录验证
				public static boolean admin_login(String aname,String apass){
					String sql="select * from admin_user where a_id='"+aname+"' and a_password='"+apass+"'";
					open();
					try {
						rs=smt.executeQuery(sql);
						while(rs.next()){
							return true;
						}
					} catch (SQLException e) {
						// TODO Auto-generated catch block
						System.out.print("登陆失败!");
					}
					close();
					return false;
				}
				
	//修改学生登录密码

    public static void stu_mod_password(String rsname,String rspass){
		String sql="update s_user set s_password='"+rspass+"' where s_id='"+rsname+"'";
		open();
		try {
			smt.executeUpdate(sql);
				} catch (SQLException e) {
			      System.out.print("更新失败!!");
				}
			close();
				}
	
	//注册新用户
	public static void addU(String rename,String repass,String remail){
		String sql="insert into users(user_name,user_password,user_email) values('"+rename+"','"+repass+"','"+remail+"')";
		open();
		try {
			smt.executeUpdate(sql);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			System.out.print("插入失败!!");
		}
	   close();
		
	}
	
	//返回所有问题
	public static ArrayList<Model_question> get_question(){
		ArrayList<Model_question> ul=new ArrayList<Model_question>();
		String sql="select * from question";
		open();
		try {
			rs=smt.executeQuery(sql);
			while(rs.next()){
				Model_question info=new Model_question();
				info.setSc1(rs.getString(2));
				info.setId(rs.getInt(1));
				ul.add(info);
			}
			
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			System.out.print("返回问题失败!");
		}
		close();
		return ul;
	}

	
	//返回学生姓名
	public static String get_stu_name(String sname){
		String stu_name = null;
		String sql="select * from s_user where s_id='"+sname+"'";
		open();
		try {
			rs=smt.executeQuery(sql);
			while(rs.next()){
				stu_name=rs.getString(4);
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			System.out.print("返回姓名失败!");
		}
		close();
		return stu_name;
	}
	
	
	//返回所有教师
	public static ArrayList<Model_tea> get_tea_name(){
		ArrayList<Model_tea> ul=new ArrayList<Model_tea>();
		String sql="select * from t_user";
		open();
		try {
			rs=smt.executeQuery(sql);
			while(rs.next()){
				Model_tea info=new Model_tea();
				info.setT_name(rs.getString(6));
				info.setT_id(rs.getInt(2));
				int id=rs.getInt(1);
				info.setId_1(rs.getInt(1));
				String sql1="select * from course where t_user_id='"+id+"'";
				rs1=smt1.executeQuery(sql1);
				while(rs1.next()){
					info.setT_course(rs1.getString(2));//返回课程名称
					info.setCourse_id(rs1.getInt(1));//返回课程ID
				}
				ul.add(info);
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			System.out.print("返回所有教师失败!");
		}
		close();
		return ul;
		
	}
	
	
	//更新教师的评教分数
	public static void update_pingjiao(int stu_id,int id_1,int course_id,String time,int sc1,int sc2,int sc3,int sc4
			,int sc5,int sc6,int sc7,int sc8,int sc9,int sc10,String area ){
		open();
		String sql="select * from evaluate where t_user_id='"+id_1+"' and s_user_id='"+stu_id+"'";
		try {
			rs=smt.executeQuery(sql);
			if(rs.next()){
				String sql1="update evaluate set sc1='"+sc1+"',sc2='"+sc2+"'," +
					"sc3='"+sc3+"',sc4='"+sc4+"',sc5='"+sc5+"',sc6='"+sc6+"'," +
							"sc7='"+sc7+"',sc8='"+sc8+"',sc9='"+sc9+"',sc10='"+sc10+"'" +
									",comments='"+area+"',time='"+time+"' where s_user_id='"+stu_id+"'" +
											" and t_user_id='"+id_1+"'";
				smt1.executeUpdate(sql1);
			}else{
				String sql2="insert into evaluate(s_user_id,t_user_id,time,course_id," +
						"sc1,sc2,sc3,sc4,sc5,sc6," +
						"sc7,sc8,sc9,sc10,comments)" +
						" values('"+stu_id+"','"+id_1+"','"+time+"','"+course_id+"','"+sc1+"'" +
								",'"+sc2+"','"+sc3+"','"+sc4+"','"+sc5+"','"+sc6+"'" +
										",'"+sc7+"','"+sc8+"','"+sc9+"','"+sc10+"','"+area+"')";
				smt2.executeUpdate(sql2);
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			System.out.print("修改评分失败");
		}
		close();
		
		
	}
	
	
	//返回学生基本信息
	public static ArrayList<Model_stu> get_stu_info(int s_id){
		ArrayList<Model_stu> ul=new ArrayList<Model_stu>();
		String sql="select * from s_user where s_id='"+s_id+"'";
		open();
		try {
			rs=smt.executeQuery(sql);
			while(rs.next()){
				Model_stu info=new Model_stu();
				info.setS_zhuanye(rs.getString(5));
				info.setS_tel(rs.getString(6));
				info.setS_sex(rs.getString(7));
				info.setS_yuanxi(rs.getString(8));
				info.setS_address(rs.getString(9));
				info.setS_zhengzhi(rs.getString(10));
				info.setS_birthday(rs.getString(11));
				info.setS_minzu(rs.getString(12));
				ul.add(info);
			}
			
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			System.out.print("返回学生信息失败!");
		}
		close();
		return ul;
	}
	
	
	//修改学生信息
	public static void mod_stu_info(int s_id,String sex,String tel,String adress,String birthday,String minzu){
		String sql="update s_user set s_sex='"+sex+"',s_tel='"+tel+"'," +
					"s_address='"+adress+"',s_birthday='"+birthday+"',s_minzu='"+minzu+"' where s_id='"+s_id+"'";
		open();
		try {
			smt.executeUpdate(sql);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			System.out.print("修改学生信息失败!");
		}
		close();
	}

	
	//返回所有学生信息
	public static ArrayList<Model_stu> get_all_stu(int t_id){
		ArrayList<Model_stu> ul=new ArrayList<Model_stu>();
		String sql="select * from s_user";
		open();
		try {
			rs=smt.executeQuery(sql);
			while(rs.next()){
				Model_stu info=new Model_stu();
				info.setId(rs.getInt(1));
				info.setS_id(rs.getInt(2));
				int s_id=rs.getInt(2);
				info.setS_name(rs.getString(4));
				info.setS_zhuanye(rs.getString(5));
				
				String sql1="select * from t_user where t_id='"+t_id+"'";
				rs1=smt1.executeQuery(sql1);
				while(rs1.next()){
					int t_ID=rs1.getInt(1);//返回教师序号
					String sql2="select * from evaluate where s_user_id='"+s_id+"' and t_user_id='"+t_ID+"'";
					rs2=smt2.executeQuery(sql2);
					if(rs2.next()){
						info.setS_if("已评教");
					}
					else
						info.setS_if("未评教");
				}
				ul.add(info);
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			System.out.print("返回所有学生信息失败!");
		}
		close();
		return ul;
	}
	
	
	//返回评测单个学生评测结果
	public static ArrayList<Model_score> get_score(int s_id,int t_id){
		ArrayList<Model_score> ul=new ArrayList<Model_score>();
		open();
		String sql="select * from t_user where t_id='"+t_id+"'";
		try {
			rs=smt.executeQuery(sql);
			while(rs.next()){
				int id=rs.getInt(1);//返回教师序号
				String sql1="select * from evaluate where s_user_id='"+s_id+"' and t_user_id='"+id+"'";
				rs1=smt1.executeQuery(sql1);
				while(rs1.next()){
					Model_score info=new Model_score();	
					info.setSc1(rs1.getInt(6));
					info.setSc2(rs1.getInt(7));
					info.setSc3(rs1.getInt(8));
					info.setSc4(rs1.getInt(9));
					info.setSc5(rs1.getInt(10));
					info.setSc6(rs1.getInt(11));
					info.setSc7(rs1.getInt(12));
					info.setSc8(rs1.getInt(13));
					info.setSc9(rs1.getInt(14));
					info.setSc10(rs1.getInt(15));
					info.setComments(rs1.getString(16));
					ul.add(info);
				}
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			System.out.print("返回评测单个学生评测结果失败!");
		}
		close();
		return ul;
	}
	
	//返回指定教师所教的课程
	public static String get_course(int t_id){
		String course_name=null;
		String sql="select * from t_user where t_id='"+t_id+"'";
		open();
		try {
			rs=smt.executeQuery(sql);
			while(rs.next()){
				int id=rs.getInt(1);
				String sql1="select * from course where t_user_id='"+id+"'";
				rs1=smt1.executeQuery(sql1);
				while(rs1.next())
					course_name=rs1.getString(2);
			}
			
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			System.out.print("返回指定教师所教的课程失败!");
		}
		close();
		return course_name;
	}
	
	
	//分数段人数统计分析
	public static ArrayList<Model_score> get_all_score(int t_id,int i){
		
		ArrayList<Model_score> ul=new ArrayList<Model_score>();
		int id=get_tea_id(t_id);
			try {
				for(int i1=1;i1<=10;i1++){
					
					String sql="select count(*) from evaluate where t_user_id='"+id+"' and sc"+i+"='"+i1+"'";
					
					open();
				rs=smt.executeQuery(sql);
				while(rs.next()){
					System.out.println("人数:"+rs.getInt(1));
					Model_score info=new Model_score();
					switch(i){
					case 1:
						info.setSc1(rs.getInt(1));
					case 2:
						info.setSc2(rs.getInt(1));
					case 3:
						info.setSc3(rs.getInt(1));
					case 4:
						info.setSc4(rs.getInt(1));
					case 5:
						info.setSc5(rs.getInt(1));
					case 6:
						info.setSc6(rs.getInt(1));
					case 7:
						info.setSc7(rs.getInt(1));
					case 8:
						info.setSc8(rs.getInt(1));
					case 9:
						info.setSc9(rs.getInt(1));
					case 10:
						info.setSc10(rs.getInt(1));
						
					}
					ul.add(info);
				}
				close();
				
				}
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			
		}
			
		return ul;
	}
	
	//返回教师序号,和上一个函数专用
	public static int get_tea_id(int t_id){
		int id=0;
		String sql="select * from t_user where t_id='"+t_id+"'";
		open();
		try {
			rs1=smt1.executeQuery(sql);
			while(rs1.next()){
				id=rs1.getInt(1);
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			System.out.print("返回教师序号失败!");
		}
		close();
		return id;
	}
	
	//返回已评教人数
	public static int get_yes_count(int t_id){
		int count=0;
		int id=get_tea_id(t_id);
		String sql="select count(*) from evaluate where t_user_id='"+id+"'";
		open();
		try {
			rs=smt.executeQuery(sql);
			while(rs.next()){
				count=rs.getInt(1);
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			System.out.print("返回已评教人数失败!");
		}
		close();
		return count;
	}
	
	
	//修改评教问题
	public static void mod_question(String sc1,int i){
	
			String sql="update question set sc1='"+sc1+"' where id='"+i+"'";
			open();
			try {
				smt.executeUpdate(sql);
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				System.out.print("修改评教问题!");
			}
			close();
		
	}
	
	//管理员返回所有学生
	public static ArrayList<Model_stu> admin_get_all_stu(){
		ArrayList<Model_stu> ul=new ArrayList<Model_stu>();
		String sql="select * from s_user";
		open();
		try {
			rs=smt.executeQuery(sql);
			while(rs.next()){
				Model_stu info=new Model_stu();
				info.setId(rs.getInt(1));
				info.setS_id(rs.getInt(2));
				info.setS_name(rs.getString(4));
				info.setS_zhuanye(rs.getString(5));
				ul.add(info);
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		close();
		return ul;
	}
	
	//管理员删除学生
	public static void admin_del_stu(int s_id){
		String sql="delete from s_user where s_id='"+s_id+"'";
		open();
		try {
			smt.executeUpdate(sql);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			System.out.print("删除出错!");
		}
		close();
	}
	
	//管理员返回所有教师
	public static ArrayList<Model_tea> admin_get_all_tea(){
		ArrayList<Model_tea> ul=new ArrayList<Model_tea>();
		String sql="select * from t_user";
		open();
		try {
			rs=smt.executeQuery(sql);
			while(rs.next()){
				Model_tea info=new Model_tea();
				info.setId_1(rs.getInt(1));
				info.setT_id(rs.getInt(2));
				info.setT_name(rs.getString(6));
				info.setT_sex(rs.getString(5));
				info.setT_tel(rs.getString(4));
				info.setT_xueli(rs.getString(7));
				ul.add(info);
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		close();
		return ul;
	}
	
}

实体类
Model_question.java

package com.home.pojo;

public class Model_question {
	private int id;
	private String sc1;
	/*private String sc2;
	private String sc3;
	private String sc4;
	private String sc5;
	private String sc6;
	private String sc7;
	private String sc8;
	private String sc9;
	private String sc10;*/
	

	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getSc1() {
		return sc1;
	}
	public void setSc1(String sc1) {
		this.sc1 = sc1;
	}
	/*public String getSc2() {
		return sc2;
	}
	public void setSc2(String sc2) {
		this.sc2 = sc2;
	}
	public String getSc3() {
		return sc3;
	}
	public void setSc3(String sc3) {
		this.sc3 = sc3;
	}
	public String getSc4() {
		return sc4;
	}
	public void setSc4(String sc4) {
		this.sc4 = sc4;
	}
	public String getSc5() {
		return sc5;
	}
	public void setSc5(String sc5) {
		this.sc5 = sc5;
	}
	public String getSc6() {
		return sc6;
	}
	public void setSc6(String sc6) {
		this.sc6 = sc6;
	}
	public String getSc7() {
		return sc7;
	}
	public void setSc7(String sc7) {
		this.sc7 = sc7;
	}
	public String getSc8() {
		return sc8;
	}
	public void setSc8(String sc8) {
		this.sc8 = sc8;
	}
	public String getSc9() {
		return sc9;
	}
	public void setSc9(String sc9) {
		this.sc9 = sc9;
	}
	public String getSc10() {
		return sc10;
	}
	public void setSc10(String sc10) {
		this.sc10 = sc10;
	}*/

	
}

Model_score.java

package com.home.pojo;

public class Model_score {
	private int sc1;
	private int sc2;
	private int sc3;
	private int sc4;
	private int sc5;
	private int sc6;
	private int sc7;
	private int sc8;
	private int sc9;
	private int sc10;
    private String comments;
	
	
	public String getComments() {
		return comments;
	}
	public void setComments(String comments) {
		this.comments = comments;
	}
	public int getSc1() {
		return sc1;
	}
	public void setSc1(int sc1) {
		this.sc1 = sc1;
	}
	public int getSc2() {
		return sc2;
	}
	public void setSc2(int sc2) {
		this.sc2 = sc2;
	}
	public int getSc3() {
		return sc3;
	}
	public void setSc3(int sc3) {
		this.sc3 = sc3;
	}
	public int getSc4() {
		return sc4;
	}
	public void setSc4(int sc4) {
		this.sc4 = sc4;
	}
	public int getSc5() {
		return sc5;
	}
	public void setSc5(int sc5) {
		this.sc5 = sc5;
	}
	public int getSc6() {
		return sc6;
	}
	public void setSc6(int sc6) {
		this.sc6 = sc6;
	}
	public int getSc7() {
		return sc7;
	}
	public void setSc7(int sc7) {
		this.sc7 = sc7;
	}
	public int getSc8() {
		return sc8;
	}
	public void setSc8(int sc8) {
		this.sc8 = sc8;
	}
	public int getSc9() {
		return sc9;
	}
	public void setSc9(int sc9) {
		this.sc9 = sc9;
	}
	public int getSc10() {
		return sc10;
	}
	public void setSc10(int sc10) {
		this.sc10 = sc10;
	}
	

}

servlet
Admin_course.java

package com.home.operate;

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

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

import com.home.dao.MyDao;
import com.home.pojo.Model_tea;

public class Admin_course extends HttpServlet {

	/**
	 * Constructor of the object.
	 */
	public Admin_course() {
		super();
	}

	/**
	 * Destruction of the servlet. <br>
	 */
	public void destroy() {
		super.destroy(); // Just puts "destroy" string in log
		// Put your code here
	}

	/**
	 * The doGet method of the servlet. <br>
	 *
	 * This method is called when a form has its tag value method equals to get.
	 * 
	 * @param request the request send by the client to the server
	 * @param response the response send by the server to the client
	 * @throws ServletException if an error occurred
	 * @throws IOException if an error occurred
	 */
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		ArrayList<Model_tea> ul=new ArrayList<Model_tea>();
		ul=MyDao.get_tea_name();
		request.setAttribute("c_ul", ul);
		request.getRequestDispatcher("admin/admin_course.jsp").forward(request, response);
	}

	/**
	 * The doPost method of the servlet. <br>
	 *
	 * This method is called when a form has its tag value method equals to post.
	 * 
	 * @param request the request send by the client to the server
	 * @param response the response send by the server to the client
	 * @throws ServletException if an error occurred
	 * @throws IOException if an error occurred
	 */
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		this.doGet(request, response);
	}

	/**
	 * Initialization of the servlet. <br>
	 *
	 * @throws ServletException if an error occurs
	 */
	public void init() throws ServletException {
		// Put your code here
	}

}

Admin_stu.java

package com.home.operate;

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

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

import com.home.dao.MyDao;
import com.home.pojo.Model_stu;

public class Admin_stu extends HttpServlet {

	/**
	 * Constructor of the object.
	 */
	public Admin_stu() {
		super();
	}

	/**
	 * Destruction of the servlet. <br>
	 */
	public void destroy() {
		super.destroy(); // Just puts "destroy" string in log
		// Put your code here
	}

	/**
	 * The doGet method of the servlet. <br>
	 *
	 * This method is called when a form has its tag value method equals to get.
	 * 
	 * @param request the request send by the client to the server
	 * @param response the response send by the server to the client
	 * @throws ServletException if an error occurred
	 * @throws IOException if an error occurred
	 */
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		ArrayList<Model_stu> ul=new ArrayList<Model_stu>();
		ul=MyDao.admin_get_all_stu();
		request.setAttribute("s_ul", ul);
		
		request.getRequestDispatcher("admin/admin_stu.jsp").forward(request, response);
	}

	/**
	 * The doPost method of the servlet. <br>
	 *
	 * This method is called when a form has its tag value method equals to post.
	 * 
	 * @param request the request send by the client to the server
	 * @param response the response send by the server to the client
	 * @throws ServletException if an error occurred
	 * @throws IOException if an error occurred
	 */
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		this.doGet(request, response);
		
	}

	/**
	 * Initialization of the servlet. <br>
	 *
	 * @throws ServletException if an error occurs
	 */
	public void init() throws ServletException {
		// Put your code here
	}

}

写在最后

如果运行代码中遇到问题,或者需要完整源码和报告,可以加博主V交流:Code2Life2

觉得有用,别忘了一键三连哈!

  • 1
    点赞
  • 22
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论
学生管理系统是一个用于管理学生信息系统。在这个系统中,可以实现学生的增加、删除、修改和查询等功能。为了实现这个系统,我们可以使用Servlet、JDBC和MySQL来完成。 首先,需要使用Servlet来处理客户端的请求和生成响应。Servlet可以接收来自用户的请求,并根据请求的不同调用相应的方法来处理这些请求。例如,当用户需要添加一个学生时,Servlet可以调用相应的方法来进行学生信息的添加操作,并返回相应的结果给用户。 其次,需要使用JDBC来连接数据库。JDBC是一个用于在Java应用程序和数据库之间进行连接的API。通过使用JDBC,我们可以建立与MySQL数据库的连接,并执行相应的SQL语句来对学生信息进行增、删、改、查操作。例如,当用户需要查询学生信息时,我们可以使用JDBC执行SELECT语句来获取所需的学生信息。 最后,需要使用MySQL数据库来存储学生信息MySQL是一个开源的关系型数据库管理系统。在学生管理系统中,我们可以创建一个学生信息表,包含学生的姓名、年龄、性别等字段。通过使用MySQL,我们可以将学生信息保存在数据库中,并实现学生信息的增、删、改、查操作。 综上所述,利用Servlet、JDBC和MySQL可以实现学生管理系统。通过Servlet接收用户请求并生成响应,通过JDBC连接数据库并执行相应的SQL语句,通过MySQL存储学生信息。这样,就可以实现学生的增加、删除、修改和查询等功能

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

anmu4200

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值