基于javaweb的JSP+Servlet学生选课信息管理系统(java+jsp+servlet+javascript+mysql)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

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

适用

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

功能说明

470023582402

480023582402

490023582402

510023582402

520023582402

530023582402

基于javaweb的JSP+Servlet学生选课信息管理系统(java+jsp+servlet+javascript+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项目:否;

技术栈

JSP+CSS+JavaScript+Servlet+mysql

使用说明

  1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven; 若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中conn/Conn.java配置文件中的数据库配置改为自己的配置; 4. 运行项目,输入localhost:8080/Ten 登录 注:Tomcat中设置路径必须为/Ten,否则会有异常 学生账号/密码:1514010919/123456 老师账号/密码:1/admin

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
		out.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">");
out.println("<HTML>");
out.println(" <HEAD><TITLE>A Servlet</TITLE></HEAD>");
out.println(" <BODY><center>");
try{
request.setCharacterEncoding("utf-8");
Course cou = new Course(request.getParameter("Cname"),request.getParameter("Ccredit"));
DaoCou insert = new DaoCou();
int rs = insert.insertCou(cou);
if(rs!=0){
out.println("添加成功:"+cou.getCNo());
}else{
out.println("添加失败"+cou.getCNo());

}
response.sendRedirect("/Ten/tea/selectCou.jsp");
}catch(Exception e){e.printStackTrace();}
out.println(" </center></BODY>");
out.println("</HTML>");
out.flush();
out.close();
}

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

}
package com.ten.ser.stu;




@SuppressWarnings("serial")
public class serDeleteStu extends HttpServlet {
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


@SuppressWarnings("serial")
public class serDoLogin extends HttpServlet {

/**
* Constructor of the object.
*/
public serDoLogin() {
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 {
this.doPost(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 {
response.setContentType("text/html;charset=utf-8");
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
 * @throws IOException if an error occurred
*/
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
this.doPost(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 {

response.setContentType("text/html;charset=utf-8");
PrintWriter out = response.getWriter();
out.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">");
out.println("<HTML>");
out.println(" <HEAD><TITLE>A Servlet</TITLE></HEAD>");
out.println(" <BODY>");
try{

DaoCou delete = new DaoCou();
int rs = delete.deleteCou(Integer.parseInt(request.getParameter("id")));
if(rs==0){
out.println("<center>删除失败!</center>");
response.sendRedirect("/Ten/tea/selectCou.jsp");
}else {
out.println("<center>删除成功!</center>");
response.sendRedirect("/Ten/tea/selectCou.jsp");
}


}catch(Exception e){e.printStackTrace();}
out.println("</BODY>");
out.println("</HTML>");
out.flush();
out.close();
}
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
	 *
* @throws ServletException if an error occurs
*/
public void init() throws ServletException {
// Put your code here
}

}
package com.ten.ser;



@SuppressWarnings("serial")
public class serDoLogout extends HttpServlet {

/**
* Constructor of the object.
*/
public serDoLogout() {
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 {
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
/**
* Constructor of the object.
*/
public serDeleteStu() {
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 {
this.doPost(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 {

response.setContentType("text/html;charset=utf-8");
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

response.setContentType("text/html;charset=utf-8");
PrintWriter out = response.getWriter();
out.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">");
out.println("<HTML>");
out.println(" <HEAD><TITLE>A Servlet</TITLE></HEAD>");
out.println(" <BODY><center>");
try{
request.setCharacterEncoding("utf-8");
Student stu = new Student(Integer.parseInt(request.getParameter("SNo")),request.getParameter("Sname")
,request.getParameter("Spassword"),request.getParameter("Sclass"),request.getParameter("Ssex"),0);
DaoStu update = new DaoStu();
int rs = update.updateStu(stu);
if(rs!=0){
out.println("修改成功:"+stu.getSNo());
}else{
out.println("修改失败"+stu.getSNo());
}
response.sendRedirect("/Ten/tea/selectStu.jsp");
}catch(Exception e){e.printStackTrace();}

out.println("</center></BODY>");
out.println("</HTML>");
out.flush();
out.close();
}

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

}
package com.ten.ser.stu;



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