一、系统简介
本项目采用eclipse工具开发,jsp+servlet+jquery技术编写,数据库采用的是mysql,navicat开发工具。
系统一共分为2个角色分别是:学生,教师
二、模块简介
学生
1、登录注册
2、个人信息管理
3、学生管理
4、课程查看,购买
5、购买记录
教师
1、登录注册
2、个人信息管理
3、教师管理
4、课程管理
5、购买记录
项目简介:
难度等级:✩✩✩
用户类型:2角色(学生,教师)
设计模式:MVC
项目架构:B/S架构
开发语言:Java语言
前端技术:HTML、CSS、JS、JQuery等
后端技术:JSP、servlet框架
运行环境:Windows7或10、JDK1.8
运行工具:本系统采用Eclipse开发,仅支持Eclipse运行,不支持MyEclipse和IDEA运行,因为三者的骨架不一样,强行导入打开运行可能会导致出现未知的错误。(如若想用idea运行,需要转换!!!!)
数 据 库:MySQL5.5/5.7/8.0版本
运行服务器:Tomcat7.0/8.0/8.5/9.0等版本
是否基于Maven环境:否
是否采用框架:是
数据库表数量:4张表
JSP页面数量:15多张
是否有分页:有分页
相关截图
相关代码
<%@ page language="java" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<jsp:include page="/WEB-INF/common/header.jsp"/>
<script language="javascript">
function check1()
{
if(document.ThisForm.userName.value=="")
{
alert("请输入用户名");
document.ThisForm.userName.focus();
return false;
}
if(document.ThisForm.password.value=="")
{
alert("请输入密码");
document.ThisForm.password.focus();
return false;
}
if(document.ThisForm.type.value=="-1")
{
alert("请选择登录身份");
document.ThisForm.type.focus();
return false;
}
document.form1.submit();
}
function reg()
{//参考https://blog.csdn.net/seamon_love/article/details/81698870
var strUrl = "<%=path %>/LoginServlet?action=toRegiste";//
var ret = window.open(strUrl,"","height=400, width=800, top=200, left=400, toolbar=no, menubar=yes, scrollbars=no, resizable=no, location=no, status=no");
}
function reg2()
{//参考https://blog.csdn.net/seamon_love/article/details/81698870
var strUrl = "<%=path %>/StudentServlet?action=toRegiste2";//
var ret = window.open(strUrl,"","height=400, width=800, top=200, left=400, toolbar=no, menubar=yes, scrollbars=no, resizable=no, location=no, status=no");
}
</script>
</head>
<body>
<body>
<br>
<br>
<br>
<br>
<table width="559" height="423" border="0" align="center" cellpadding="0" cellspacing="0" background="<%=path %>/img/">
<tr>
<td><div align="center" style="FONT-WEIGHT: bold; FONT-SIZE: 25pt;">学生课程管理系统</div></td>
</tr>
<tr>
<td width="559">
<form name="ThisForm" method="post" action="LoginServlet?action=login">
<table width="410" height="198" border="0" align="right" cellpadding="0" cellspacing="0">
<tr>
<td height="5" colspan="2"></td>
</tr>
<tr>
<td width="356" valign="bottom">
用户名:<input name="userName" type="text" class="input2" onMouseOver="this.style.background='#F0DAF3';" onMouseOut="this.style.background='#FFFFFF'">
</td>
<span style="color:red">${msg}</span>
</tr>
<tr>
<td height="10" colspan="2" valign="bottom"></td>
</tr>
<tr>
<td height="31" colspan="2" valign="top" class="STYLE15">
密 码:
<input name="password" type="password" size="21" class="input2" align="bottom" onMouseOver="this.style.background='#F0DAF3';" onMouseOut="this.style.background='#FFFFFF'">
</td>
</tr>
<tr>
<td height="10" colspan="2" valign="bottom"></td>
</tr>
<tr style="display: block">
<td height="31" colspan="2" valign="top" class="STYLE15">
身 份:
<select class="INPUT_text" name="type">
<option value="" selected="selected">请选择登录身份</option>
<option value="2">学生</option>
<option value="3">教师</option>
</select>
</td>
</tr>
<tr>
<td colspan="2" valign="top">
<input name="button" type="submit" class="submit1" value="登录" >
<input name="button" type="button" class="submit1" value="学生注册" onclick="reg()">
<input name="button" type="button" class="submit1" value="教师注册" onclick="reg2()">
<img id="indicator" src="<%=path %>/img/loading.gif" style="display:none"/>
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</body>
protected void login(HttpServletRequest request, HttpServletResponse response) throws Exception {//跳转到添加用户界�?
String userName = request.getParameter("userName");
String password = request.getParameter("password");
String type = request.getParameter("type");
if(type != null && type.equals("2")){//学生
Student student = ls.selectStudent(userName,password);
if (student == null) {
request.setAttribute("msg","账号或者密码错误"); //绑定参数
request.getRequestDispatcher("/WEB-INF/views/login.jsp").forward(request,response);
} else {
request.getSession().setAttribute("type",2);
request.getSession().setAttribute("student",student);
request.getRequestDispatcher("/WEB-INF/views/main.jsp").forward(request,response);
}
}else if(type != null && type.equals("3")){//教师
Teacher teacher = ls.selectTeacher(userName,password);
if (teacher == null) {
request.setAttribute("msg","账号或者密码错误"); //绑定参数
request.getRequestDispatcher("/WEB-INF/views/login.jsp").forward(request,response);
} else {
request.getSession().setAttribute("type",3);
request.getSession().setAttribute("teacher",teacher);
request.getRequestDispatcher("/WEB-INF/views/main.jsp").forward(request,response);
}
}else{
request.setAttribute("msg","请选择角色");
request.getRequestDispatcher("/WEB-INF/views/login.jsp").forward(request,response);
}
}