使用Shiro權限管理框架,實現登陸驗證和登陸信息的儲存,根據不一樣的登陸帳戶,分發權限角色,對不一樣頁面url進行角色設置javascript
管理員可對 教師信息、學生信息、課程信息 進行 增刪改查 操做,管理員帳戶,能夠重置非管理員帳戶的密碼css
教師登錄後,能夠獲取其,教授的課程列表,並能夠給已經選擇該課程的同窗打分,沒法對已經給完分的同窗進行二次操做html
學生登陸後,根據學生信息,獲取其已經選擇的課程,和已經修完的課程前端
①登錄界面java
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
50
51
52
53
54
55
|
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!
DOCTYPE
html>
<
html
>
<
head
>
<
title
></
title
>
<
meta
name="viewport" content="width=device-width, initial-scale=1.0">
<!-- 引入bootstrap -->
<
link
rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/bootstrap.min.css">
<!-- 引入JQuery bootstrap.js-->
<
script
src="${pageContext.request.contextPath}/js/jquery-3.2.1.min.js"></
script
>
<
script
src="${pageContext.request.contextPath}/js/bootstrap.min.js"></
script
>
<
style
type="text/css">
body{
background: url("${pageContext.request.contextPath}/images/login.jpg")repeat;
}
#login-box {
/*border:1px solid #F00;*/
padding: 35px;
border-radius:15px;
background: #FF8C00;
color: #fff;
}
</
style
>
</
head
>
<
body
>
<
div
class="container" id="top">
<
div
class="row" style="margin-top: 280px; ">
<
div
class="col-md-4"></
div
>
<
div
class="col-md-4" id="login-box">
<
form
class="form-horizontal" role="form" action="${pageContext.request.contextPath}/login" id="from1" method="post">
<
div
class="form-group">
<
label
for="firstname" class="col-sm-3 control-label">帳號:</
label
>
<
div
class="col-sm-9">
<
input
type="text" class="form-control" id="userID" placeholder="請輸入名字" name="username">
</
div
>
</
div
>
<
div
class="form-group">
<
label
for="lastname" class="col-sm-3 control-label">密碼:</
label
>
<
div
class="col-sm-9">
<
input
type="password" class="form-control" id="password" placeholder="請輸入密碼" name="password">
</
div
>
</
div
>
<
div
class="form-group pull-right" style="margin-right: 15px;">
<
div
class="col-sm-offset-2 col-sm-10">
<
button
type="submit" class="btn btn-primary">登陸</
button
>
</
div
>
</
div
>
</
form
>
</
div
>
<
div
class="col-md-4"></
div
>
</
div
>
</
div
>
</
body
>
</
html
>
|
②管理員操做界面之添加課程jquery
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!
DOCTYPE
html>
<
html
>
<
head
>
<
title
></
title
>
<
meta
name="viewport" content="width=device-width, initial-scale=1.0">
<!-- 引入bootstrap -->
<
link
rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/bootstrap.min.css">
<!-- 引入JQuery bootstrap.js-->
<
script
src="${pageContext.request.contextPath}/js/jquery-3.2.1.min.js"></
script
>
<
script
src="${pageContext.request.contextPath}/js/bootstrap.min.js"></
script
>
</
head
>
<
body
>
<!-- 頂欄 -->
<
jsp:include
page="top.jsp"></
jsp:include
>
<!-- 中間主體 -->
<
div
class="container" id="content">
<
div
class="row">
<
jsp:include
page="menu.jsp"></
jsp:include
>
<
div
class="col-md-10">
<
div
class="panel panel-default">
<
div
class="panel-heading">
<
div
class="row">
<
h1
style="text-align: center;">添加課程信息</
h1
>
</
div
>
</
div
>
<
div
class="panel-body">
<
form
class="form-horizontal" role="form" action="${pageContext.request.contextPath}/admin/addCourse" id="editfrom" method="post">
<
div
class="form-group">
<
label
for="inputEmail3" class="col-sm-2 control-label">課程號</
label
>
<
div
class="col-sm-10">
<
input
type="number" class="form-control" id="inputEmail3" name="courseid" placeholder="請輸入課程號">
</
div
>
</
div
>
<
div
class="form-group">
<
label
for="inputPassword3" class="col-sm-2 control-label">課程名稱</
label
>
<
div
class="col-sm-10">
<
input
type="text" class="form-control" id="inputPassword3" name="coursename" placeholder="請輸入課程名稱">
</
div
>
</
div
>
<
div
class="form-group">
<
label
for="inputPassword3" class="col-sm-2 control-label" name="grade">授課老師編號</
label
>
<
div
class="col-sm-10">
<
select
class="form-control" name="teacherid">
<
c:forEach
items="${teacherList}" var="item">
<
option
value="${item.userid}">${item.username}</
option
>
</
c:forEach
>
</
select
>
</
div
>
</
div
>
<
div
class="form-group">
<
label
for="inputPassword3" class="col-sm-2 control-label">上課時間</
label
>
<
div
class="col-sm-10">
<
input
type="text" class="form-control" name="coursetime" placeholder="請輸入上課時間">
</
div
>
</
div
>
<
div
class="form-group">
<
label
for="inputPassword3" class="col-sm-2 control-label">上課地點</
label
>
<
div
class="col-sm-10">
<
input
type="text" class="form-control" name="classroom" placeholder="上課地點">
</
div
>
</
div
>
<
div
class="form-group">
<
label
for="inputEmail3" class="col-sm-2 control-label">週數</
label
>
<
div
class="col-sm-10">
<
input
type="number" class="form-control" name="courseweek" placeholder="請輸入週數">
</
div
>
</
div
>
<
div
class="form-group">
<
label
for="inputPassword3" class="col-sm-2 control-label" name="coursetype">課程的類型:</
label
>
<
div
class="col-sm-10">
<
select
class="form-control" name="coursetype">
<
option
value="必修課">必修課</
option
>
<
option
value="選修課">選修課</
option
>
<
option
value="公共課">公共課</
option
>
</
select
>
</
div
>
</
div
>
<
div
class="form-group">
<
label
for="inputPassword3" class="col-sm-2 control-label" name="grade">所屬院系</
label
>
<
div
class="col-sm-10">
<
select
class="form-control" name="collegeid">
<
c:forEach
items="${collegeList}" var="item">
<
option
value="${item.collegeid}">${item.collegename}</
option
>
</
c:forEach
>
</
select
>
</
div
>
</
div
>
<
div
class="form-group">
<
label
for="inputEmail3" class="col-sm-2 control-label">學分:</
label
>
<
div
class="col-sm-10">
<
input
type="number" class="form-control" name="score" placeholder="請輸入學分">
</
div
>
</
div
>
<
div
class="form-group" style="text-align: center">
<
button
class="btn btn-default" type="submit">提交</
button
>
<
button
class="btn btn-default" type="reset">重置</
button
>
</
div
>
</
form
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
<
div
class="container" id="footer">
<
div
class="row">
<
div
class="col-md-12"></
div
>
</
div
>
</
div
>
</
body
>
<
script
type="text/javascript">
$("#nav li:nth-child(1)").addClass("active")
</
script
>
</
html
>
|
③學生操做界面之顯示已選課程bootstrap
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<!
DOCTYPE
html>
<
html
>
<
head
>
<
title
>課程信息顯示</
title
>
<
meta
name="viewport" content="width=device-width, initial-scale=1.0">
<!-- 引入bootstrap -->
<
link
rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/bootstrap.min.css">
<!-- 引入JQuery bootstrap.js-->
<
script
src="${pageContext.request.contextPath}/js/jquery-3.2.1.min.js"></
script
>
<
script
src="${pageContext.request.contextPath}/js/bootstrap.min.js"></
script
>
<%--<
meta
http-equiv="Content-Type" content="text/html; charset=UTF-8">--%>
</
head
>
<
body
>
<!-- 頂欄 -->
<
jsp:include
page="top.jsp"></
jsp:include
>
<!-- 中間主體 -->
<
div
class="container" id="content">
<
div
class="row">
<
jsp:include
page="menu.jsp"></
jsp:include
>
<
div
class="col-md-10">
<
div
class="panel panel-default">
<
div
class="panel-heading">
<
div
class="row">
<
h1
class="col-md-5">已選課程</
h1
>
</
div
>
</
div
>
<
table
class="table table-bordered">
<
thead
>
<
tr
>
<
th
>課程號</
th
>
<
th
>課程名稱</
th
>
<
th
>授課老師編號</
th
>
<
th
>上課時間</
th
>
<
th
>上課地點</
th
>
<
th
>週數</
th
>
<
th
>課程類型</
th
>
<
th
>學分</
th
>
<
th
>操做</
th
>
</
tr
>
</
thead
>
<
tbody
>
<
c:forEach
items="${selectedCourseList}" var="item">
<%--輸出還沒修完的課程--%>
<
c:if
test="${!item.over}">
<
tr
>
<
td
>${item.couseCustom.courseid}</
td
>
<
td
>${item.couseCustom.coursename}</
td
>
<
td
>${item.couseCustom.teacherid}</
td
>
<
td
>${item.couseCustom.coursetime}</
td
>
<
td
>${item.couseCustom.classroom}</
td
>
<
td
>${item.couseCustom.courseweek}</
td
>
<
td
>${item.couseCustom.coursetype}</
td
>
<
td
>${item.couseCustom.score}</
td
>
<
td
>
<
button
class="btn btn-default btn-xs btn-info" onClick="location.href='/student/outCourse?id=${item.courseid}'">退課</
button
>
<!--彈出框-->
</
td
>
</
tr
>
</
c:if
>
</
c:forEach
>
</
tbody
>
</
table
>
<
div
class="panel-footer">
<
c:if
test="${pagingVO != null}">
<
nav
style="text-align: center">
<
ul
class="pagination">
<
li
><
a
href="${pageContext.request.contextPath}/student/showCourse?page=${pagingVO.upPageNo}">«上一頁</
a
></
li
>
<
li
class="active"><
a
href="">${pagingVO.curentPageNo}</
a
></
li
>
<
c:if
test="${pagingVO.curentPageNo+1 <= pagingVO.totalCount}">
<
li
><
a
href="${pageContext.request.contextPath}/student/showCourse?page=${pagingVO.curentPageNo+1}">${pagingVO.curentPageNo+1}</
a
></
li
>
</
c:if
>
<
c:if
test="${pagingVO.curentPageNo+2 <= pagingVO.totalCount}">
<
li
><
a
href="${pageContext.request.contextPath}/student/showCourse?page=${pagingVO.curentPageNo+2}">${pagingVO.curentPageNo+2}</
a
></
li
>
</
c:if
>
<
c:if
test="${pagingVO.curentPageNo+3 <= pagingVO.totalCount}">
<
li
><
a
href="${pageContext.request.contextPath}/student/showCourse?page=${pagingVO.curentPageNo+3}">${pagingVO.curentPageNo+3}</
a
></
li
>
</
c:if
>
<
c:if
test="${pagingVO.curentPageNo+4 <= pagingVO.totalCount}">
<
li
><
a
href="${pageContext.request.contextPath}/student/showCourse?page=${pagingVO.curentPageNo+4}">${pagingVO.curentPageNo+4}</
a
></
li
>
</
c:if
>
<
li
><
a
href="${pageContext.request.contextPath}/student/showCourse?page=${pagingVO.totalCount}">最後一頁»</
a
></
li
>
</
ul
>
</
nav
>
</
c:if
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
<
div
class="container" id="footer">
<
div
class="row">
<
div
class="col-md-12"></
div
>
</
div
>
</
div
>
</
body
>
<
script
type="text/javascript">
<%--設置菜單中--%>
$("#nav li:nth-child(2)").addClass("active")
<
c:if
test="${pagingVO != null}">
if (${pagingVO.curentPageNo} == ${pagingVO.totalCount}) {
$(".pagination li:last-child").addClass("disabled")
};
if (${pagingVO.curentPageNo} == ${1}) {
$(".pagination li:nth-child(1)").addClass("disabled")
};
</
c:if
>
function confirmd() {
var msg = "您真的肯定要刪除嗎?!";
if (confirm(msg)==true){
return true;
}else{
return false;
}
}
$("#sub").click(function () {
$("#form1").submit();
});
</
script
>
</
html
>
|
④教室操做界面之打分系統安全
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!
DOCTYPE
html>
<
html
>
<
head
>
<
title
></
title
>
<
meta
name="viewport" content="width=device-width, initial-scale=1.0">
<!-- 引入bootstrap -->
<
link
rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/bootstrap.min.css">
<!-- 引入JQuery bootstrap.js-->
<
script
src="${pageContext.request.contextPath}/js/jquery-3.2.1.min.js"></
script
>
<
script
src="${pageContext.request.contextPath}/js/bootstrap.min.js"></
script
>
</
head
>
<
body
>
<!-- 頂欄 -->
<
jsp:include
page="top.jsp"></
jsp:include
>
<!-- 中間主體 -->
<
div
class="container" id="content">
<
div
class="row">
<
jsp:include
page="menu.jsp"></
jsp:include
>
<
div
class="col-md-10">
<
div
class="panel panel-default">
<
div
class="panel-heading">
<
div
class="row">
<
h1
style="text-align: center;">學生打分</
h1
>
</
div
>
</
div
>
<
div
class="panel-body">
<
form
name="reset" class="form-horizontal" role="form" action="${pageContext.request.contextPath}/teacher/mark" id="editfrom" method="post" onsubmit="return check()">
<
div
class="form-group">
<
div
class="col-sm-10">
<
input
readonly="readonly" type="hidden" class="form-control" name="courseid" id="inputEmail3" value="${selectedCourse.courseid}">
</
div
>
</
div
>
<
div
class="form-group">
<
label
for="inputEmail3" class="col-sm-2 control-label">學號</
label
>
<
div
class="col-sm-10">
<
input
readonly="readonly" type="text" class="form-control" name="studentid" id="inputEmail3" value="${selectedCourse.studentid}">
</
div
>
</
div
>
<
div
class="form-group">
<
label
for="inputPassword3" class="col-sm-2 control-label">姓名</
label
>
<
div
class="col-sm-10">
<
input
readonly="readonly" type="text" name="name" class="form-control" id="inputPassword3" value="${selectedCourse.studentCustom.username}">
</
div
>
</
div
>
<
div
class="form-group">
<
label
for="inputPassword3" class="col-sm-2 control-label">成績</
label
>
<
div
class="col-sm-10">
<
input
type="number" name="mark" class="form-control" id="inputPassword3" placeholder="請輸入成績">
</
div
>
</
div
>
<
div
class="form-group" style="text-align: center">
<
button
class="btn btn-default" type="submit">提交</
button
>
<
button
class="btn btn-default">重置</
button
>
</
div
>
</
form
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
<
div
class="container" id="footer">
<
div
class="row">
<
div
class="col-md-12"></
div
>
</
div
>
</
div
>
</
body
>
<
script
>
$("#nav li:nth-child(1)").addClass("active")
function check() {
if(reset.mark.value==""||reset.mark.value==null)
{alert("請輸入成績");return false;}
}
</
script
>
</
html
>
|
⑤使用技術前端框架
IOC容器:Spring框架
Web框架:SpringMVC
ORM框架:Mybatis
安全框架:Shiro
前端框架:Bootstrap