# Conflicts: # src/servlet/admin/AdminLogin.javadevelop
commit
b5a65b3e05
@ -1,109 +1,111 @@
|
|||||||
<%@ page language="java" contentType="text/html; charset=UTF-8"
|
<%@ page language="java" contentType="text/html; charset=UTF-8"
|
||||||
pageEncoding="UTF-8"%>
|
pageEncoding="UTF-8"%>
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
<link rel="stylesheet" href="../public/layui/css/layui.css" media="all">
|
<!-- 引入layui的CSS文件 -->
|
||||||
<script src="../public/layui/layui.js"></script>
|
<link rel="stylesheet" href="../public/layui/css/layui.css" media="all">
|
||||||
<title>Insert title here</title>
|
|
||||||
|
<title>Insert title here</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<table class="layui-hide" id="annTable" lay-filter="formFilter"></table>
|
<!-- 定义一个隐藏的表格,用于展示公告信息 -->
|
||||||
|
<table class="layui-hide" id="annTable" lay-filter="formFilter"></table>
|
||||||
<script type="text/html" id="headBar">
|
|
||||||
<button type="button" class="layui-btn layui-btn-sm" lay-event="add"><i class="layui-icon"><i class="layui-icon layui-icon-release" style="font-size: 20px; color: yellow;"></i> 发布新公告</i></button>
|
<!-- 添加公告按钮 -->
|
||||||
|
<button type="button" class="layui-btn layui-btn-sm" lay-event="add"><i class="layui-icon"><i class="layui-icon layui-icon-release" style="font-size: 20px; color: yellow;"></i> 发布新公告</i></button>
|
||||||
|
|
||||||
|
<!-- 编辑和删除按钮 -->
|
||||||
|
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
|
||||||
|
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
|
||||||
</script>
|
</script>
|
||||||
|
<script>
|
||||||
<script type="text/html" id="rightBar">
|
<!-- 使用layui的模块 -->
|
||||||
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
|
layui.use(['table','jquery'], function(){
|
||||||
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
|
$ = layui.jquery; // 获取jQuery对象
|
||||||
</script>
|
var table = layui.table; // 获取table模块
|
||||||
<script>
|
// 进行渲染
|
||||||
layui.use(['table','jquery'], function(){
|
var tableIns = table.render({
|
||||||
$ = layui.jquery;
|
elem: '#annTable' // 绑定到页面中的表格元素
|
||||||
var table = layui.table;
|
,url:'./announcement' // 数据接口地址
|
||||||
// 进行渲染
|
,toolbar: '#headBar' // 工具栏模板选择器
|
||||||
var tableIns = table.render({
|
,height: 600 // 设置表格高度
|
||||||
elem: '#annTable'
|
,cols: [[ // 定义表格列
|
||||||
,url:'./announcement'
|
{field:'id', width:80, title: 'ID', sort: true} // ID列
|
||||||
,toolbar: '#headBar'
|
,{field:'title', width:230, title: '标题'} // 标题列
|
||||||
,height: 600
|
,{field:'detail', width:580, title: '公告'} // 公告内容列
|
||||||
,cols: [[
|
,{field:'publish_date', title: '发布日期', minWidth: 100, sort: true} // 发布日期列
|
||||||
{field:'id', width:80, title: 'ID', sort: true}
|
,{fixed: 'right', title:'操作', toolbar: '#rightBar', align: 'center', width:150} // 操作列
|
||||||
,{field:'title', width:230, title: '标题'}
|
]]
|
||||||
,{field:'detail', width:580, title: '公告'}
|
});
|
||||||
,{field:'publish_date', title: '发布日期', minWidth: 100, sort: true}
|
|
||||||
,{fixed: 'right', title:'操作', toolbar: '#rightBar', align: 'center', width:150}
|
// 头部工具栏事件
|
||||||
]]
|
table.on('toolbar(formFilter)', function(obj){
|
||||||
});
|
var checkStatus = table.checkStatus(obj.config.id); // 获取选中状态
|
||||||
|
switch(obj.event){
|
||||||
// 头部工具栏事件
|
// 添加公告
|
||||||
table.on('toolbar(formFilter)', function(obj){
|
case 'add':
|
||||||
var checkStatus = table.checkStatus(obj.config.id);
|
var addCardLayer = layer.open({
|
||||||
switch(obj.event){
|
type: 2, // iframe层
|
||||||
// 添加公告
|
title: '发布公告', // 标题
|
||||||
case 'add':
|
area: ['800px', '500px'], // 宽高
|
||||||
var addCardLayer = layer.open({
|
maxmin: true, // 允许最大化最小化
|
||||||
type: 2,
|
shadeClose: true, // 点击遮罩关闭
|
||||||
title: '发布公告',
|
content: '08add.jsp', // iframe的URL
|
||||||
area: ['800px', '500px'],
|
});
|
||||||
maxmin: true,
|
//layer.full(addCardLayer);
|
||||||
shadeClose: true,
|
};
|
||||||
content: '08add.jsp',
|
});
|
||||||
});
|
|
||||||
//layer.full(addCardLayer);
|
// 侧边工具栏事件
|
||||||
};
|
table.on(('tool(formFilter)'), function(obj){
|
||||||
|
var data = obj.data; // 获取当前行的数据
|
||||||
|
var layEvent = obj.event; // 获取触发的事件类型
|
||||||
|
var id = data.id; // 获取当前行的ID
|
||||||
|
var tr = obj.tr; // 获取当前行的DOM对象
|
||||||
|
switch(obj.event){
|
||||||
|
case 'edit':
|
||||||
|
layer.open({
|
||||||
|
type: 2, // iframe层
|
||||||
|
title: '更改信息', // 标题
|
||||||
|
area: ['800px', '600px'], // 宽高
|
||||||
|
maxmin: true, // 允许最大化最小化
|
||||||
|
shadeClose: true, // 点击遮罩关闭
|
||||||
|
content: '08edit.jsp?id=' +id, // URL传递参数ID
|
||||||
|
})
|
||||||
|
break;
|
||||||
|
case 'del':
|
||||||
|
layer.confirm('确定要删除么?',function(){ // 确认对话框
|
||||||
|
layer.msg("ok"); // 提示消息
|
||||||
|
$.ajax({
|
||||||
|
url: './announcementDel', // URL地址
|
||||||
|
data: 'id=' +id, // 传递参数ID
|
||||||
|
type: 'get', // HTTP请求类型
|
||||||
|
dataType: 'json', // 返回数据类型
|
||||||
|
timeout: 3000, // 超时时间
|
||||||
|
success: function(data){ // 成功回调函数
|
||||||
|
if(data.code == 0){ // 如果返回码为0
|
||||||
|
layer.msg(data.msg,{ // 显示成功消息
|
||||||
|
icon: 6, // icon样式
|
||||||
|
anim: 5, // 动画效果
|
||||||
|
time: 500 // 显示时间
|
||||||
|
});
|
||||||
|
setTimeout(function(){ // 延时刷新父页面
|
||||||
|
parent.location.reload();
|
||||||
|
},500);
|
||||||
|
}else{ // 如果返回码不为0
|
||||||
|
layer.msg(data.code); // 显示错误消息
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function(){ // 失败回调函数
|
||||||
|
layer.msg("连接超时"); // 显示超时消息
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
// 侧边工具栏事件
|
|
||||||
table.on(('tool(formFilter)'), function(obj){
|
|
||||||
var data = obj.data;
|
|
||||||
var layEvent = obj.event;
|
|
||||||
var id = data.id;
|
|
||||||
var tr = obj.tr;
|
|
||||||
switch(obj.event){
|
|
||||||
case 'edit':
|
|
||||||
layer.open({
|
|
||||||
type: 2,
|
|
||||||
title: '更改信息',
|
|
||||||
area: ['800px', '600px'],
|
|
||||||
maxmin: true,
|
|
||||||
shadeClose: true,
|
|
||||||
content: '08edit.jsp?id=' +id,
|
|
||||||
})
|
|
||||||
break;
|
|
||||||
case 'del':
|
|
||||||
layer.confirm('确定要删除么?',function(){
|
|
||||||
layer.msg("ok");
|
|
||||||
$.ajax({
|
|
||||||
url: './announcementDel',
|
|
||||||
data: 'id=' +id,
|
|
||||||
type: 'get',
|
|
||||||
dataType: 'json',
|
|
||||||
timeout: 3000,
|
|
||||||
success: function(data){
|
|
||||||
if(data.code == 0){
|
|
||||||
layer.msg(data.msg,{
|
|
||||||
icon: 6,
|
|
||||||
anim: 5,
|
|
||||||
time: 500
|
|
||||||
});
|
|
||||||
setTimeout(function(){
|
|
||||||
parent.location.reload();
|
|
||||||
},500);
|
|
||||||
}else{
|
|
||||||
layer.msg(data.code);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function(){
|
|
||||||
layer.msg("连接超时");
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
@ -1,133 +1,141 @@
|
|||||||
body{
|
body {
|
||||||
background: white;
|
background: white; /* 设置背景颜色为白色 */
|
||||||
color: #DDD;
|
color: #DDD; /* 设置文本颜色为浅灰色 */
|
||||||
font-family: 'Helvetica', 'Lucida Grande', 'Arial', sans-serif;
|
font-family: 'Helvetica', 'Lucida Grande', 'Arial', sans-serif; /* 设置字体 */
|
||||||
}
|
}
|
||||||
.border{
|
|
||||||
height: 99%;
|
.border {
|
||||||
width: 30%;
|
height: 99%; /* 设置高度为父容器的99% */
|
||||||
|
width: 30%; /* 设置宽度为父容器的30% */
|
||||||
}
|
}
|
||||||
.rain{
|
|
||||||
height: 400px;
|
.rain {
|
||||||
width: 35%;
|
height: 400px; /* 设置固定高度为400像素 */
|
||||||
|
width: 35%; /* 设置宽度为父容器的35% */
|
||||||
}
|
}
|
||||||
/* Layout with mask */
|
|
||||||
.rain{
|
/* 使用遮罩布局 */
|
||||||
padding: 10px 12px 12px 10px;
|
.rain {
|
||||||
-moz-box-shadow: 10px 10px 10px rgba(255,255,255,1) inset, -9px -9px 8px rgba(255,255,255,1) inset;
|
padding: 10px 12px 12px 10px; /* 设置内边距 */
|
||||||
-webkit-box-shadow: 8px 8px 8px rgba(255,255,255,1) inset, -9px -9px 8px rgba(255,255,255,1) inset;
|
-moz-box-shadow: 10px 10px 10px rgba(255,255,255,1) inset, -9px -9px 8px rgba(255,255,255,1) inset; /* Firefox阴影效果 */
|
||||||
box-shadow: 8px 8px 8px rgba(255,255,255,1) inset, -9px -9px 8px rgba(255,255,255,1) inset;
|
-webkit-box-shadow: 8px 8px 8px rgba(255,255,255,1) inset, -9px -9px 8px rgba(255,255,255,1) inset; /* Webkit阴影效果 */
|
||||||
margin: 100px auto;
|
box-shadow: 8px 8px 8px rgba(255,255,255,1) inset, -9px -9px 8px rgba(255,255,255,1) inset; /* 标准阴影效果 */
|
||||||
|
margin: 100px auto; /* 设置外边距,使元素居中 */
|
||||||
}
|
}
|
||||||
/* Artifical "border" to clear border to bypass mask */
|
|
||||||
.border{
|
/* 人工“边框”以清除遮罩 */
|
||||||
padding: 1px;
|
.border {
|
||||||
-moz-border-radius: 5px;
|
padding: 1px; /* 设置内边距 */
|
||||||
-webkit-border-radius: 5px;
|
-moz-border-radius: 5px; /* Firefox圆角效果 */
|
||||||
border-radius: 5px;
|
-webkit-border-radius: 5px; /* Webkit圆角效果 */
|
||||||
|
border-radius: 5px; /* 标准圆角效果 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.border,
|
.border,
|
||||||
.rain,
|
.rain,
|
||||||
.border.start,
|
.border.start,
|
||||||
.rain.start{
|
.rain.start {
|
||||||
background-repeat: repeat-x, repeat-x, repeat-x, repeat-x;
|
background-repeat: repeat-x, repeat-x, repeat-x, repeat-x; /* 设置背景重复模式 */
|
||||||
background-position: 0 0, 0 0, 0 0, 0 0;
|
background-position: 0 0, 0 0, 0 0, 0 0; /* 设置背景位置 */
|
||||||
/* Blue-ish Green Fallback for Mozilla */
|
/* Firefox下的蓝色渐变背景 */
|
||||||
background-image: -moz-linear-gradient(left, #09BA5E 0%, #00C7CE 15%, #3472CF 26%, #00C7CE 48%, #0CCF91 91%, #09BA5E 100%);
|
background-image: -moz-linear-gradient(left, #09BA5E 0%, #00C7CE 15%, #3472CF 26%, #00C7CE 48%, #0CCF91 91%, #09BA5E 100%);
|
||||||
/* Add "Highlight" Texture to the Animation */
|
/* 添加动画纹理 */
|
||||||
background-image: -webkit-gradient(linear, left top, right top, color-stop(1%,rgba(0,0,0,.3)), color-stop(23%,rgba(0,0,0,.1)), color-stop(40%,rgba(255,231,87,.1)), color-stop(61%,rgba(255,231,87,.2)), color-stop(70%,rgba(255,231,87,.1)), color-stop(80%,rgba(0,0,0,.1)), color-stop(100%,rgba(0,0,0,.25)));
|
background-image: -webkit-gradient(linear, left top, right top, color-stop(1%,rgba(0,0,0,.3)), color-stop(23%,rgba(0,0,0,.1)), color-stop(40%,rgba(255,231,87,.1)), color-stop(61%,rgba(255,231,87,.2)), color-stop(70%,rgba(255,231,87,.1)), color-stop(80%,rgba(0,0,0,.1)), color-stop(100%,rgba(0,0,0,.25)));
|
||||||
/* Starting Color */
|
/* 起始颜色 */
|
||||||
background-color: #39f;
|
background-color: #39f;
|
||||||
/* Just do something for IE-suck */
|
/* IE滤镜效果 */
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00BA1B', endColorstr='#00BA1B',GradientType=1 );
|
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00BA1B', endColorstr='#00BA1B',GradientType=1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Non-keyframe fallback animation */
|
/* 非关键帧动画回退 */
|
||||||
.border.end,
|
.border.end,
|
||||||
.rain.end{
|
.rain.end {
|
||||||
-moz-transition-property: background-position;
|
-moz-transition-property: background-position; /* Firefox过渡属性 */
|
||||||
-moz-transition-duration: 30s;
|
-moz-transition-duration: 30s; /* Firefox过渡持续时间 */
|
||||||
-moz-transition-timing-function: linear;
|
-moz-transition-timing-function: linear; /* Firefox过渡时间函数 */
|
||||||
-webkit-transition-property: background-position;
|
-webkit-transition-property: background-position; /* Webkit过渡属性 */
|
||||||
-webkit-transition-duration: 30s;
|
-webkit-transition-duration: 30s; /* Webkit过渡持续时间 */
|
||||||
-webkit-transition-timing-function: linear;
|
-webkit-transition-timing-function: linear; /* Webkit过渡时间函数 */
|
||||||
-o-transition-property: background-position;
|
-o-transition-property: background-position; /* Opera过渡属性 */
|
||||||
-o-transition-duration: 30s;
|
-o-transition-duration: 30s; /* Opera过渡持续时间 */
|
||||||
-o-transition-timing-function: linear;
|
-o-transition-timing-function: linear; /* Opera过渡时间函数 */
|
||||||
transition-property: background-position;
|
transition-property: background-position; /* 标准过渡属性 */
|
||||||
transition-duration: 30s;
|
transition-duration: 30s; /* 标准过渡持续时间 */
|
||||||
transition-timing-function: linear;
|
transition-timing-function: linear; /* 标准过渡时间函数 */
|
||||||
background-position: -5400px 0, -4600px 0, -3800px 0, -3000px 0;
|
background-position: -5400px 0, -4800px 0, -4200px 0, -3600px 0; /* 设置背景位置 */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Keyfram-licious animation */
|
/* 关键帧动画 */
|
||||||
@-webkit-keyframes colors {
|
@-webkit-keyframes colors {
|
||||||
0% {background-color: pink;}
|
0% {background: pink;} /* 开始时的颜色 */
|
||||||
15% {background-color: hotpink;}
|
15% {background: hotpink;} /* 15%时的颜色 */
|
||||||
30% {background-color: rosybrown;}
|
30% {background: rosybrown;} /* 30%时的颜色 */
|
||||||
45% {background-color: steelblue;}
|
45% {background: steelblue;} /* 45%时的颜色 */
|
||||||
60% {background-color: black;}
|
60% {background: black;} /* 60%时的颜色 */
|
||||||
75% {background-color: #c9c0d3;}
|
75% {background: #c9c0d3;} /* 75%时的颜色 */
|
||||||
90% {background-color: darkgreen;}
|
90% {background: darkgreen;} /* 90%时的颜色 */
|
||||||
100% {background-color: orange;}
|
100% {background: orange;} /* 结束时的颜色 */
|
||||||
}
|
}
|
||||||
.border,.rain{
|
|
||||||
-webkit-animation-direction: normal;
|
.border,
|
||||||
-webkit-animation-duration: 20s;
|
.rain {
|
||||||
-webkit-animation-iteration-count: infinite;
|
-webkit-animation-direction: normal; /* Webkit动画方向 */
|
||||||
-webkit-animation-name: colors;
|
-webkit-animation-duration: 20s; /* Webkit动画持续时间 */
|
||||||
-webkit-animation-timing-function: ease;
|
-webkit-animation-iteration-count: infinite; /* Webkit动画迭代次数 */
|
||||||
|
-webkit-animation-timing-function: ease; /* Webkit动画时间函数 */
|
||||||
|
-webkit-animation-name: colors; /* Webkit动画名称 */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* In-Active State Style */
|
/* 无焦点状态样式 */
|
||||||
.border.unfocus{
|
.border.unfocus {
|
||||||
background: #333 !important;
|
background: #333 !important; /* 强制背景颜色 */
|
||||||
-moz-box-shadow: 0px 0px 15px rgba(255,255,255,.2);
|
-moz-box-shadow: 0px 0px 15px rgba(255,255,255,.2) inset; /* Firefox阴影效果 */
|
||||||
-webkit-box-shadow: 0px 0px 15px rgba(255,255,255,.2);
|
-webkit-box-shadow: 0px 0px 15px rgba(255,255,255,.2) inset; /* Webkit阴影效果 */
|
||||||
box-shadow: 0px 0px 15px rgba(255,255,255,.2);
|
box-shadow: 0px 0px 15px rgba(255,255,255,.2) inset; /* 标准阴影效果 */
|
||||||
-webkit-animation-name: none;
|
-webkit-animation-name: none; /* Webkit无动画 */
|
||||||
}
|
}
|
||||||
.rain.unfocus{
|
|
||||||
background: #000 !important;
|
.rain.unfocus {
|
||||||
-webkit-animation-name: none;
|
background: #000 !important; /* 强制背景颜色 */
|
||||||
|
-webkit-animation-name: none; /* Webkit无动画 */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Regular Form Styles */
|
/* 表单样式 */
|
||||||
form{
|
form {
|
||||||
background: darkred;
|
background: darkred; /* 设置背景颜色为深红色 */
|
||||||
-moz-border-radius: 5px;
|
-moz-border-radius: 5px; /* Firefox圆角效果 */
|
||||||
-webkit-border-radius: 5px;
|
-webkit-border-radius: 5px; /* Webkit圆角效果 */
|
||||||
border-radius: 5px;
|
border-radius: 5px; /* 标准圆角效果 */
|
||||||
height: 100%;
|
height: 100%; /* 设置高度为父容器的100% */
|
||||||
width: 335%;
|
width: 335%; /* 设置宽度为父容器的335% */
|
||||||
background: -moz-radial-gradient(50% 46% 90deg,circle closest-corner, white, lightblue);
|
background: -moz-radial-gradient(center 46% 90deg, closest-corner, white, lightblue); /* Firefox径向渐变背景 */
|
||||||
background: -webkit-gradient(radial, 50% 50%, 0, 50% 50%, 150, from(lightcyan), to(lightblue));
|
background: -webkit-gradient(radial, 50% 50%, 0, 50% 50%, 150, from(lightcyan), to(lightblue));/* Webkit径向渐变背景 */
|
||||||
}
|
}
|
||||||
form label{
|
|
||||||
display: block;
|
form label {
|
||||||
padding: 10px 10px 5px 15px;
|
display: block; /* 块级显示 */
|
||||||
font-size: 20px;
|
padding: 10px 15px 10px 15px; /* 设置内边距 */
|
||||||
color: hotpink;
|
font-size: 20px; /* 设置字体大小 */
|
||||||
|
color: hotpink; /* 设置字体颜色 */
|
||||||
}
|
}
|
||||||
|
|
||||||
form textarea{
|
form input {
|
||||||
display: block;
|
display: block; /* 块级显示 */
|
||||||
margin: 5px 10px 10px 15px;
|
margin: 5px 10px 10px 15px; /* 设置外边距 */
|
||||||
width: 85%;
|
width: 85%; /* 设置宽度为父容器的85% */
|
||||||
background: #f0f8ff;
|
background: #f0f8ff; /* 设置背景颜色 */
|
||||||
-moz-box-shadow: 0px 0px 4px grey inset;
|
-moz-box-shadow: 0px 0px 4px grey inset; /* Firefox阴影效果 */
|
||||||
-webkit-box-shadow: 0px 0px 4px grey inset;
|
-webkit-box-shadow: 0px 0px 4px grey inset; /* Webkit阴影效果 */
|
||||||
box-shadow: 0px 0px 4px grey inset;
|
box-shadow: 0px 0px 4px grey inset; /* 标准阴影效果 */
|
||||||
outline: 1px solid black;
|
outline: 1px solid black; /* 设置轮廓线 */
|
||||||
border: 1px solid grey;
|
border: 1px solid grey; /* 设置边框 */
|
||||||
padding: 5px;
|
padding: 5px; /* 设置内边距 */
|
||||||
color: black;
|
color: black; /* 设置字体颜色 */
|
||||||
font-size: 16px;
|
font-size: 16px; /* 设置字体大小 */
|
||||||
}
|
}
|
||||||
form textarea:focus{
|
|
||||||
outline: 2px solid white;
|
form input:focus {
|
||||||
color: #c0c0c0;
|
outline: 2px solid white; /* 设置聚焦时的轮廓线 */
|
||||||
background-color: white;
|
color: #c0c0c0; /* 设置聚焦时的字体颜色 */
|
||||||
|
background-color: white; /* 设置聚焦时的背景颜色 */
|
||||||
}
|
}
|
||||||
|
|
@ -1,29 +1,29 @@
|
|||||||
package servlet.manager;
|
package servlet.manager; // 定义包名
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException; // 导入IOException类
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException; // 导入ServletException类
|
||||||
import javax.servlet.annotation.WebServlet;
|
import javax.servlet.annotation.WebServlet; // 导入WebServlet注解
|
||||||
import javax.servlet.http.HttpServlet;
|
import javax.servlet.http.HttpServlet; // 导入HttpServlet类
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest; // 导入HttpServletRequest类
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse; // 导入HttpServletResponse类
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession; // 导入HttpSession类
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Servlet implementation class Quit
|
* Servlet implementation class Quit
|
||||||
*/
|
*/
|
||||||
@WebServlet("/manager/quit")
|
@WebServlet("/manager/quit") // 定义Servlet的URL映射
|
||||||
public class Quit extends HttpServlet {
|
public class Quit extends HttpServlet { // 继承HttpServlet类
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L; // 序列化版本号
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { // 重写doGet方法
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
HttpSession session = req.getSession();
|
HttpSession session = req.getSession(); // 获取当前会话
|
||||||
if (session.getAttribute("manager") != null) {
|
if (session.getAttribute("manager") != null) { // 如果会话中存在"manager"属性
|
||||||
session.removeAttribute("manager");
|
session.removeAttribute("manager"); // 移除"manager"属性
|
||||||
}
|
}
|
||||||
resp.sendRedirect(req.getContextPath() + "/loginManager.html");
|
resp.sendRedirect(req.getContextPath() + "/loginManager.html"); // 重定向到登录页面
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in new issue