基于javaweb的JSP+Servlet学籍管理系统(java+jsp+javascript+servlet+mysql)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

200023592402

210023592402

220023592402

240023592402

250023592402

260023592402

270023592402

280023592402

290023592402

基于javaweb的JSP+Servlet学籍管理系统(java+jsp+javascript+servlet+mysql)

项目介绍

本项目为后台管理系统; 管理员角色包含以下功能:

登录、专业管理、班级管理、课程管理、学生学籍管理、学生成绩管理等功能。

环境需要

1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。 2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA; 3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可 4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;  5.数据库:MySql 5.7版本; 6.是否Maven项目: 否;

技术栈

  1. 后端:servlet 2. 前端:JSP+css+javascript

使用说明

  1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven; 若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中com/dao/DB.java配置文件中的数据库配置改为自己的配置; 4. 运行项目,输入http://localhost:8080/ 登录

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
}
mydb.closed();
return result;
}


public String xuankeDel(int stu_id,int kecheng_id)
{
try
{
Thread.sleep(700);
} catch (InterruptedException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
String result="no";
String sql="delete from t_stu_kecheng where stu_id=? and kecheng_id=?";
Object[] params={stu_id,kecheng_id};
DB mydb=new DB();
try
{
mydb.doPstm(sql, params);
int ii=mydb.getCount();
if(ii==1)
{
result="yes";
}
else
{
result="no";
}
}
catch(Exception e)
{
e.printStackTrace();
}
mydb.closed();
return result;
}

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
	Object[] params={name,jieshao,del};
DB mydb=new DB();
mydb.doPstm(sql, params);
mydb.closed();

req.setAttribute("message", "操作成功");
req.setAttribute("path", "zhuanye?type=zhuanyeMana");

String targetURL = "/common/success.jsp";
dispatch(targetURL, req, res);
}

public void zhuanyeDel(HttpServletRequest req,HttpServletResponse res)
{
String sql="update t_zhuanye set del='yes' where id="+Integer.parseInt(req.getParameter("id"));
Object[] params={};
DB mydb=new DB();
mydb.doPstm(sql, params);
mydb.closed();

req.setAttribute("message", "操作成功");
req.setAttribute("path", "zhuanye?type=zhuanyeMana");

String targetURL = "/common/success.jsp";
dispatch(targetURL, req, res);
}

public void zhuanyeMana(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException
{
List zhuanyeList=new ArrayList();
String sql="select * from t_zhuanye where del='no'";
Object[] params={};
DB mydb=new DB();
try
{
mydb.doPstm(sql, params);
ResultSet rs=mydb.getRs();
while(rs.next())
{
Tzhuanye zhuanye=new Tzhuanye();
zhuanye.setId(rs.getInt("id"));
zhuanye.setName(rs.getString("name"));
zhuanye.setJieshao(rs.getString("jieshao"));
zhuanyeList.add(zhuanye);
}
rs.close();
}
catch(Exception e)
{
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
		mydb.closed();
System.out.println(kechengList.size());
req.setAttribute("kechengList", kechengList);
req.setAttribute("stu_id", stu_id);
req.getRequestDispatcher("admin/stu_xuanke/kechengByStu.jsp").forward(req, res);
}

public void dispatch(String targetURI,HttpServletRequest request,HttpServletResponse response)
{
RequestDispatcher dispatch = getServletContext().getRequestDispatcher(targetURI);
try
{
dispatch.forward(request, response);
return;
}
catch (ServletException e)
{
e.printStackTrace();
}
catch (IOException e)
{

e.printStackTrace();
}
}
public void init(ServletConfig config) throws ServletException
{
super.init(config);
}

public void destroy()
{

}
}
package com.action;



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
public class jiangcheng_servlet extends HttpServlet
{
public void service(HttpServletRequest req,HttpServletResponse res)throws ServletException, IOException
{
String type=req.getParameter("type");

if(type.endsWith("jiangchengMana"))
{
jiangchengMana(req, res);
}
if(type.endsWith("jiangchengAdd"))
{
jiangchengAdd(req, res);
}
if(type.endsWith("jiangchengDel"))
{
jiangchengDel(req, res);
}

if(type.endsWith("jiangchengEditPre"))
{
jiangchengEditPre(req, res);
}
if(type.endsWith("jiangchengSearch"))
{
jiangchengSearch(req, res);
}
}


public void jiangchengAdd(HttpServletRequest req,HttpServletResponse res)
{
int stu_id=Integer.parseInt(req.getParameter("stu_id"));
String shijian=req.getParameter("shijian");
String shuxing=req.getParameter("shuxing");
String beizhu=req.getParameter("beizhu");
String del="no";
String sql="insert into t_jiangcheng(`stu_id`,`shijian`,`shuxing`,`beizhu`,`del`) values(?,?,?,?,?)";
Object[] params={stu_id,shijian,shuxing,beizhu,del};
DB mydb=new DB();
mydb.doPstm(sql, params);
mydb.closed();
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
       String targetURL = "/common/success.jsp";
dispatch(targetURL, req, res);
}

public void chengjiDel(HttpServletRequest req,HttpServletResponse res)
{
String sql="update t_chengji set del='yes' where id="+Integer.parseInt(req.getParameter("id"));
Object[] params={};
DB mydb=new DB();
mydb.doPstm(sql, params);
mydb.closed();

req.setAttribute("message", "操作成功");
req.setAttribute("path", "chengji?type=chengjiMana");

String targetURL = "/common/success.jsp";
dispatch(targetURL, req, res);
}

public void chengjiMana(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException
{
List chengjiList=new ArrayList();
String sql="select * from t_chengji where del='no'";
Object[] params={};
DB mydb=new DB();
try
{
mydb.doPstm(sql, params);
ResultSet rs=mydb.getRs();
while(rs.next())
{
Tchengji chengji=new Tchengji();
chengji.setId(rs.getInt("id"));
chengji.setStu_id(rs.getInt("stu_id"));
chengji.setKecheng_id(rs.getInt("kecheng_id"));
chengji.setChengji(rs.getInt("chengji"));
chengji.setXuenian(rs.getString("xuenian"));
chengji.setStu_xuehao(liuService.getStuXuehao(rs.getInt("stu_id")));
chengji.setKecheng_name(liuService.getKechengName(rs.getInt("kecheng_id")));
chengjiList.add(chengji);
}
rs.close();
}
catch(Exception e)
{
e.printStackTrace();
}
mydb.closed();
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
{
String type=req.getParameter("type");

if(type.endsWith("chengjiMana"))
{
chengjiMana(req, res);
}
if(type.endsWith("chengjiAdd"))
{
chengjiAdd(req, res);
}
if(type.endsWith("chengjiDel"))
{
chengjiDel(req, res);
}
}


public void chengjiAdd(HttpServletRequest req,HttpServletResponse res)
{
int stu_id=Integer.parseInt(req.getParameter("stu_id"));
int kecheng_id=Integer.parseInt(req.getParameter("kecheng_id"));
int chengji=Integer.parseInt(req.getParameter("chengji"));
String xuenian=req.getParameter("xuenian");
String del="no";
String sql="insert into t_chengji(`stu_id`,`kecheng_id`,`chengji`,`xuenian`,`del`) values(?,?,?,?,?)";
Object[] params={stu_id,kecheng_id,chengji,xuenian,del};
DB mydb=new DB();
mydb.doPstm(sql, params);
mydb.closed();

req.setAttribute("message", "操作成功");
req.setAttribute("path", "chengji?type=chengjiMana");

String targetURL = "/common/success.jsp";
dispatch(targetURL, req, res);
}

public void chengjiDel(HttpServletRequest req,HttpServletResponse res)
{
String sql="update t_chengji set del='yes' where id="+Integer.parseInt(req.getParameter("id"));
Object[] params={};
DB mydb=new DB();
mydb.doPstm(sql, params);
mydb.closed();

req.setAttribute("message", "操作成功");
req.setAttribute("path", "chengji?type=chengjiMana");


项目链接:
https://javayms.github.io?id=591122572008200um
https://javayms.pages.dev?id=591122572008200um