Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
半分.
studentmanagementsystembyjsp
提交
aaa1214d
S
studentmanagementsystembyjsp
项目概览
半分.
/
studentmanagementsystembyjsp
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
studentmanagementsystembyjsp
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
aaa1214d
编写于
6月 08, 2018
作者:
C
CheungChingYin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增添注释
上级
f9a3dbb5
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
25 addition
and
39 deletion
+25
-39
WebContent/Contain.jsp
WebContent/Contain.jsp
+17
-17
WebContent/DAOCheckLogin.jsp
WebContent/DAOCheckLogin.jsp
+1
-1
WebContent/DaoAddStudent.jsp
WebContent/DaoAddStudent.jsp
+1
-1
WebContent/DaoAdminPasswordReset.jsp
WebContent/DaoAdminPasswordReset.jsp
+2
-1
WebContent/DaoAlertStudent.jsp
WebContent/DaoAlertStudent.jsp
+1
-0
WebContent/DaoDelete.jsp
WebContent/DaoDelete.jsp
+1
-1
WebContent/DaoSearch.jsp
WebContent/DaoSearch.jsp
+1
-1
WebContent/SystemExit.jsp
WebContent/SystemExit.jsp
+1
-0
WebContent/management.jsp
WebContent/management.jsp
+0
-17
未找到文件。
WebContent/Contain.jsp
浏览文件 @
aaa1214d
...
@@ -74,9 +74,9 @@
...
@@ -74,9 +74,9 @@
<body>
<body>
<%
<%
request
.
setCharacterEncoding
(
"UTF-8"
);
request
.
setCharacterEncoding
(
"UTF-8"
);
String
pages
=
request
.
getParameter
(
"pages"
);
String
pages
=
request
.
getParameter
(
"pages"
);
//获取当前页数
int
pagesNo
=
Integer
.
parseInt
(
pages
);
int
pagesNo
=
Integer
.
parseInt
(
pages
);
//把当前页数从字符串转为整型
int
startLine
=
(
Integer
.
parseInt
(
pages
)-
1
)*
10
;
int
startLine
=
(
Integer
.
parseInt
(
pages
)-
1
)*
10
;
//指定数据库从哪一行开始读取
%>
%>
<div
class=
"contain pull-left"
>
<div
class=
"contain pull-left"
>
<form
action=
"DaoSearch.jsp"
class=
"form-inline "
>
<form
action=
"DaoSearch.jsp"
class=
"form-inline "
>
...
@@ -104,11 +104,11 @@
...
@@ -104,11 +104,11 @@
</thead>
</thead>
<tbody>
<tbody>
<%
<%
int
pageSize
=
10
;
int
pageSize
=
10
;
//指定数据库一次读取多少行
String
sqlQuery
=
"SELECT * FROM stumanagementbyweb.studentinfo limit "
+
startLine
+
","
+
pageSize
;
String
sqlQuery
=
"SELECT * FROM stumanagementbyweb.studentinfo limit "
+
startLine
+
","
+
pageSize
;
//对数据库进行伪分页读取,一次只能读10行
String
sqlAll
=
"SELECT * FROM stumanagementbyweb.studentinfo"
;
String
sqlAll
=
"SELECT * FROM stumanagementbyweb.studentinfo"
;
int
pagesCount
=
0
;
int
pagesCount
=
0
;
//用于数据库最后读出所有行后总共有多少页
int
lastRow
=
0
;
int
lastRow
=
0
;
//记录数据库的最后一行
try
{
try
{
Class
.
forName
(
"com.mysql.cj.jdbc.Driver"
);
Class
.
forName
(
"com.mysql.cj.jdbc.Driver"
);
Connection
con
=
DriverManager
.
getConnection
(
"jdbc:mysql://localhost:3306/stumanagementbyweb"
,
"root"
,
"123456"
);
Connection
con
=
DriverManager
.
getConnection
(
"jdbc:mysql://localhost:3306/stumanagementbyweb"
,
"root"
,
"123456"
);
...
@@ -117,7 +117,7 @@
...
@@ -117,7 +117,7 @@
ResultSet
rs
=
sql
.
executeQuery
(
sqlQuery
);
ResultSet
rs
=
sql
.
executeQuery
(
sqlQuery
);
ResultSet
rsAll
=
stat
.
executeQuery
(
sqlAll
);
ResultSet
rsAll
=
stat
.
executeQuery
(
sqlAll
);
rsAll
.
last
();
rsAll
.
last
();
lastRow
=
rsAll
.
getRow
();
//记录最后一行
lastRow
=
rsAll
.
getRow
();
//记录
数据库
最后一行
while
(
rs
.
next
()){
while
(
rs
.
next
()){
out
.
print
(
"
<
tr
>
");
out
.
print
(
"
<
tr
>
");
out.print("
<
td
>
"+rs.getString(1)+"
</
td
>
");
out.print("
<
td
>
"+rs.getString(1)+"
</
td
>
");
...
@@ -141,24 +141,24 @@
...
@@ -141,24 +141,24 @@
<div
class=
"pageNav"
>
<div
class=
"pageNav"
>
<ul
class=
"pagination"
>
<ul
class=
"pagination"
>
<%
<%
int
prePage
;
int
prePage
;
//上一页的页数
if
(
pagesNo
==
1
){
if
(
pagesNo
==
1
){
prePage
=
1
;
prePage
=
1
;
//若当前页是第一页,则第一页只能是当前页
}
else
{
}
else
{
prePage
=
pagesNo
-
1
;
prePage
=
pagesNo
-
1
;
//除了上述情况外上一页等于当前页-1页
}
}
%>
%>
<li
class=
"page-item"
><a
class=
"page-link"
href=
"Contain.jsp?pages=
<%=
prePage
%>
"
>
上一页
</a></li>
<li
class=
"page-item"
><a
class=
"page-link"
href=
"Contain.jsp?pages=
<%=
prePage
%>
"
>
上一页
</a></li>
<%
<%
pagesCount
=
(
lastRow
%
pageSize
==
0
)
?
(
lastRow
/
pageSize
)
:
(
lastRow
/
pageSize
+
1
);
pagesCount
=
(
lastRow
%
pageSize
==
0
)
?
(
lastRow
/
pageSize
)
:
(
lastRow
/
pageSize
+
1
);
//计算数据库能读出来的全部页数
int
minpages
=
(
pagesNo
-
3
>
0
)
?
(
pagesNo
-
3
)
:
1
;
int
minpages
=
(
pagesNo
-
3
>
0
)
?
(
pagesNo
-
3
)
:
1
;
//设定最小页,防止页数小于第一页
int
maxpages
=
(
pagesNo
+
3
>
=
pagesCount
)
?
(
pagesCount
)
:
(
pagesNo
+
3
);
int
maxpages
=
(
pagesNo
+
3
>
=
pagesCount
)
?
(
pagesCount
)
:
(
pagesNo
+
3
);
//设定最大页
for
(
int
i
=
minpages
;
i
<=
maxpages
;
i
++){
for
(
int
i
=
minpages
;
i
<=
maxpages
;
i
++){
if
(
i
==
pagesNo
){
if
(
i
==
pagesNo
){
//当前页和遍历出来的页数相等时,需要通过调用css里面的样式“active"进行高亮
out
.
print
(
"
<
li
class
='
page
-
item
active
'>
");
out
.
print
(
"
<
li
class
='
page
-
item
active
'>
");
out.print("
<
a
class
='
page
-
link
'
href
=
'
Contain
.
jsp
?
pages
=
"+i+"
'>
"+i+"
</
a
>
");
out.print("
<
a
class
='
page
-
link
'
href
=
'
Contain
.
jsp
?
pages
=
"+i+"
'>
"+i+"
</
a
>
");
out.print("
</
li
>
");
out.print("
</
li
>
");
}else{
}else{
//输出每一个分页
out.print("
<
li
class
='
page
-
item
'>
");
out.print("
<
li
class
='
page
-
item
'>
");
out.print("
<
a
class
='
page
-
link
'
href
=
'
Contain
.
jsp
?
pages
=
"+i+"
'>
"+i+"
</
a
>
");
out.print("
<
a
class
='
page
-
link
'
href
=
'
Contain
.
jsp
?
pages
=
"+i+"
'>
"+i+"
</
a
>
");
out.print("
</
li
>
");
out.print("
</
li
>
");
...
@@ -172,7 +172,7 @@
...
@@ -172,7 +172,7 @@
%>
%>
<%
<%
int
nextPage
;
int
nextPage
;
if
(
pagesNo
==
pagesCount
){
if
(
pagesNo
==
pagesCount
){
//下一页的原理和上一页同理
nextPage
=
pagesCount
;
nextPage
=
pagesCount
;
}
else
{
}
else
{
nextPage
=
pagesNo
+
1
;
nextPage
=
pagesNo
+
1
;
...
...
WebContent/DAOCheckLogin.jsp
浏览文件 @
aaa1214d
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
</head>
</head>
<body>
<body>
<%
<%
//检验管理员的用户名密码是否正确
request
.
setCharacterEncoding
(
"UTF-8"
);
request
.
setCharacterEncoding
(
"UTF-8"
);
String
user
=
request
.
getParameter
(
"user"
);
String
user
=
request
.
getParameter
(
"user"
);
String
password
=
request
.
getParameter
(
"password"
);
String
password
=
request
.
getParameter
(
"password"
);
...
...
WebContent/DaoAddStudent.jsp
浏览文件 @
aaa1214d
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
<body>
<body>
<%
<%
//添加学生资料
if
((
String
)
session
.
getAttribute
(
"user"
)==
null
){
if
((
String
)
session
.
getAttribute
(
"user"
)==
null
){
out
.
print
(
"
<
script
language
=
'
JavaScript
'>
alert
(
'
请先登录
!'
);
window
.
location
.
href
=
'
Login
.
html
'
</
script
>
");
out
.
print
(
"
<
script
language
=
'
JavaScript
'>
alert
(
'
请先登录
!'
);
window
.
location
.
href
=
'
Login
.
html
'
</
script
>
");
}
}
...
...
WebContent/DaoAdminPasswordReset.jsp
浏览文件 @
aaa1214d
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
</head>
</head>
<body>
<body>
<%
<%
//修改管理员的密码
String
user
=
session
.
getAttribute
(
"user"
).
toString
();
String
user
=
session
.
getAttribute
(
"user"
).
toString
();
String
id
=
session
.
getAttribute
(
"id"
).
toString
();
String
id
=
session
.
getAttribute
(
"id"
).
toString
();
String
passowrd
=
request
.
getParameter
(
"pwd"
);
String
passowrd
=
request
.
getParameter
(
"pwd"
);
...
@@ -26,7 +27,7 @@
...
@@ -26,7 +27,7 @@
ps
.
executeUpdate
();
ps
.
executeUpdate
();
ps
.
close
();
ps
.
close
();
con
.
close
();
con
.
close
();
session
.
removeAttribute
(
"user"
);
session
.
removeAttribute
(
"user"
);
//移除用户会话
session
.
removeAttribute
(
"id"
);
session
.
removeAttribute
(
"id"
);
out
.
print
(
"
<
script
type
=
'
text
/
javascript
'>
alert
(
'
更改密码成功
!
请重新登录
!
'
);
window
.
parent
.
frames
.
location
.
href
=
'
Login
.
html
'
;</
script
>"
);
out
.
print
(
"
<
script
type
=
'
text
/
javascript
'>
alert
(
'
更改密码成功
!
请重新登录
!
'
);
window
.
parent
.
frames
.
location
.
href
=
'
Login
.
html
'
;</
script
>"
);
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
...
...
WebContent/DaoAlertStudent.jsp
浏览文件 @
aaa1214d
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
</head>
</head>
<body>
<body>
<%
<%
//修改学生资料
if
((
String
)
session
.
getAttribute
(
"user"
)==
null
){
if
((
String
)
session
.
getAttribute
(
"user"
)==
null
){
out
.
print
(
"
<
script
language
=
'
JavaScript
'>
alert
(
'
请先登录
!'
);
window
.
location
.
href
=
'
Login
.
html
'
</
script
>
");
out
.
print
(
"
<
script
language
=
'
JavaScript
'>
alert
(
'
请先登录
!'
);
window
.
location
.
href
=
'
Login
.
html
'
</
script
>
");
...
...
WebContent/DaoDelete.jsp
浏览文件 @
aaa1214d
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
<body>
<body>
<%
<%
//删除学生资料
if
((
String
)
session
.
getAttribute
(
"user"
)==
null
){
if
((
String
)
session
.
getAttribute
(
"user"
)==
null
){
out
.
print
(
"
<
script
language
=
'
JavaScript
'>
alert
(
'
请先登录
!'
);
window
.
location
.
href
=
'
Login
.
html
'
</
script
>
");
out
.
print
(
"
<
script
language
=
'
JavaScript
'>
alert
(
'
请先登录
!'
);
window
.
location
.
href
=
'
Login
.
html
'
</
script
>
");
}
}
...
...
WebContent/DaoSearch.jsp
浏览文件 @
aaa1214d
...
@@ -95,7 +95,7 @@
...
@@ -95,7 +95,7 @@
</thead>
</thead>
<tbody>
<tbody>
<%
<%
//查询功能
if
((
String
)
session
.
getAttribute
(
"user"
)==
null
){
if
((
String
)
session
.
getAttribute
(
"user"
)==
null
){
out
.
print
(
"
<
script
language
=
'
JavaScript
'>
alert
(
'
请先登录
!'
);
window
.
location
.
href
=
'
Login
.
html
'
</
script
>
");
out
.
print
(
"
<
script
language
=
'
JavaScript
'>
alert
(
'
请先登录
!'
);
window
.
location
.
href
=
'
Login
.
html
'
</
script
>
");
}
}
...
...
WebContent/SystemExit.jsp
浏览文件 @
aaa1214d
...
@@ -13,6 +13,7 @@ if((String)session.getAttribute("user")==null){
...
@@ -13,6 +13,7 @@ if((String)session.getAttribute("user")==null){
}
}
%>
%>
<%
<%
//用户退出登录时移除会话
session
.
removeAttribute
(
"user"
);
session
.
removeAttribute
(
"user"
);
session
.
removeAttribute
(
"id"
);
session
.
removeAttribute
(
"id"
);
out
.
print
(
"
<
script
type
=
'
text
/
javascript
'>
alert
(
'
用户退出成功
!
'
);
window
.
location
.
href
=
'
Login
.
html
'
;</
script
>"
);
out
.
print
(
"
<
script
type
=
'
text
/
javascript
'>
alert
(
'
用户退出成功
!
'
);
window
.
location
.
href
=
'
Login
.
html
'
;</
script
>"
);
...
...
WebContent/management.jsp
已删除
100644 → 0
浏览文件 @
f9a3dbb5
<%@ page
language=
"java"
contentType=
"text/html; charset=UTF-8"
pageEncoding=
"UTF-8"
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=UTF-8"
>
<title>
Insert title here
</title>
</head>
<body>
<%
if
((
String
)
session
.
getAttribute
(
"user"
)==
null
){
out
.
print
(
"
<
script
language
=
'
JavaScript
'>
alert
(
'
请先登录
!'
);
window
.
location
.
href
=
'
Login
.
html
'
</
script
>"
);
}
%>
<%=
session
.
getAttribute
(
"user"
)
%>
,你好,登录成功!
</body>
</html>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录