基于javaweb的JSP+Servlet学生选课系统(java+javaweb+jdbc)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

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

适用

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

功能说明

520023022402

530023022402

540023022402

功能介绍:

用户菜单、学生管理、教师管理、课程管理、成绩排名查询

基于javaweb的JSP+Servlet学生选课系统(java+javaweb+jdbc)

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
 *            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 {

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");
request.setCharacterEncoding("utf-8");
PrintWriter out = response.getWriter();
String m_id = request.getParameter("id");
String old;
String pw1 = null;
String pw2 = null;
old = request.getParameter("oldpassword");
pw1 = request.getParameter("password1");
pw2 = request.getParameter("password2");

//查询原密码
String sql="select password from manager where id = '"+m_id+"'";
sqlBean db=new sqlBean();
ResultSet rs = db.executeQuery(sql);
String dbOldPwd = "";
try {
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 occurred
* @throws IOException if an error occurred
*/
public void goo(HttpServletRequest request,HttpServletResponse response,String kind)
throws ServletException,IOException{
if(kind.equals("student")){
//控制页面跳转
RequestDispatcher rd=getServletContext().getRequestDispatcher("/student/student.jsp");
rd.forward(request, response);
}
if(kind.equals("teacher")){
RequestDispatcher rd=getServletContext().getRequestDispatcher("/teacher/teacher.jsp");
rd.forward(request, response);
}
if(kind.equals("manager")){
RequestDispatcher rd=getServletContext().getRequestDispatcher("/manager/manager.jsp");
rd.forward(request, response);
}
}
public void doError(HttpServletRequest request,HttpServletResponse response,String str)
throws ServletException,IOException{
request.setAttribute("problem", str);
getServletConfig().getServletContext().getRequestDispatcher("/errorpage.jsp").forward(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doGet(request,response);
}


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

}
package servlet;

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
	else if(grade>=68)
jpa=2.0;
else if(grade>=66)
jpa=1.7;
else if(grade>=64)
jpa=1.3;
else if(grade>=60)
jpa=1.0;
else
jpa=0.0;
return jpa;
}

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

}
package servlet;




public class updateMpassword extends HttpServlet {

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

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

}
package servlet;




public class updateSpassword extends HttpServlet {

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

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

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
				request.setAttribute("info", str);
RequestDispatcher rd=getServletContext().getRequestDispatcher("/succpage.jsp");
rd.forward(request, response);
}

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

}
package servlet;




public class m_updatescore extends HttpServlet {

/**
* Constructor of the object.
*/
public m_updatescore() {
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.
*
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
		jpa=3.3;
else if(grade>=78)
jpa=3.0;
else if(grade>=75)
jpa=2.7;
else if(grade>=72)
jpa=2.3;
else if(grade>=68)
jpa=2.0;
else if(grade>=66)
jpa=1.7;
else if(grade>=64)
jpa=1.3;
else if(grade>=60)
jpa=1.0;
else
jpa=0.0;
return jpa;
}

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

}
package servlet;





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