集成公告、新闻发布,新闻、公告均可批量删除
This commit is contained in:
158
WebRoot/css/zzsc.css
Normal file
158
WebRoot/css/zzsc.css
Normal file
@@ -0,0 +1,158 @@
|
|||||||
|
/*reset*/
|
||||||
|
body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, code,
|
||||||
|
form, fieldset, legend, input, textarea, p, blockquote, th, td {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
font-family: "΢ÈíÑźÚ"
|
||||||
|
}
|
||||||
|
|
||||||
|
table {
|
||||||
|
border-collapse: collapse;
|
||||||
|
border-spacing: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
fieldset, img {
|
||||||
|
border: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
address, caption, cite, code, dfn, em, strong, th, var {
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
ol, ul {
|
||||||
|
list-style: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
caption, th {
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1, h2, h3, h4, h5, h6 {
|
||||||
|
font-size: 100%;
|
||||||
|
font-weight: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
q:before, q:after {
|
||||||
|
content: '';
|
||||||
|
}
|
||||||
|
|
||||||
|
abbr, acronym {
|
||||||
|
border: 0;
|
||||||
|
font-variant: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
sup {
|
||||||
|
vertical-align: text-top;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub {
|
||||||
|
vertical-align: text-bottom;
|
||||||
|
}
|
||||||
|
|
||||||
|
input:focus, textarea:focus, select:focus {
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
select, input {
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
legend {
|
||||||
|
color: #000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.clean:before, .clean:after, .clearfix:before, .clearfix:after {
|
||||||
|
content: "";
|
||||||
|
display: table;
|
||||||
|
}
|
||||||
|
|
||||||
|
.clean:after, .clearfix:after {
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
|
||||||
|
.clean, .clearfix {
|
||||||
|
zoom: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.clear {
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fl {
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fr {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.break {
|
||||||
|
word-wrap: break-word;
|
||||||
|
width: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
.linkhidden {
|
||||||
|
text-indent: -9999em;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hidden {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
/*reset*/
|
||||||
|
|
||||||
|
/*Ö÷ÒªÑùʽ*/
|
||||||
|
.subNavBox {
|
||||||
|
width: 200px;
|
||||||
|
border: solid 1px #e5e3da;
|
||||||
|
margin: 100px auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.subNav {
|
||||||
|
border-bottom: solid 1px #e5e3da;
|
||||||
|
cursor: pointer;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 14px;
|
||||||
|
color: #999;
|
||||||
|
line-height: 28px;
|
||||||
|
padding-left: 10px;
|
||||||
|
background: url(../images/jiantou1.jpg) no-repeat;
|
||||||
|
background-position: 95% 50%
|
||||||
|
}
|
||||||
|
|
||||||
|
.subNav:hover {
|
||||||
|
color: #277fc2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.currentDd {
|
||||||
|
color: #277fc2
|
||||||
|
}
|
||||||
|
|
||||||
|
.currentDt {
|
||||||
|
background-image: url(../images/jiantou.jpg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.navContent {
|
||||||
|
display: none;
|
||||||
|
border-bottom: solid 1px #e5e3da;
|
||||||
|
}
|
||||||
|
|
||||||
|
.navContent li a {
|
||||||
|
display: block;
|
||||||
|
width: 200px;
|
||||||
|
heighr: 28px;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 28px;
|
||||||
|
color: #333
|
||||||
|
}
|
||||||
|
|
||||||
|
.navContent li a:hover {
|
||||||
|
color: #fff;
|
||||||
|
background-color: #277fc2
|
||||||
|
}
|
||||||
BIN
WebRoot/images/jiantou.jpg
Normal file
BIN
WebRoot/images/jiantou.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
BIN
WebRoot/images/jiantou1.jpg
Normal file
BIN
WebRoot/images/jiantou1.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
BIN
WebRoot/images/off.png
Normal file
BIN
WebRoot/images/off.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
BIN
WebRoot/images/on.png
Normal file
BIN
WebRoot/images/on.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
@@ -163,6 +163,7 @@
|
|||||||
<!-- Mainly scripts -->
|
<!-- Mainly scripts -->
|
||||||
<script src="js/jquery-2.1.1.js"></script>
|
<script src="js/jquery-2.1.1.js"></script>
|
||||||
<script src="js/bootstrap.min.js"></script>
|
<script src="js/bootstrap.min.js"></script>
|
||||||
|
<script src="js/bootstrap.js"></script>
|
||||||
<script src="js/plugins/metisMenu/jquery.metisMenu.js"></script>
|
<script src="js/plugins/metisMenu/jquery.metisMenu.js"></script>
|
||||||
<script src="js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
|
<script src="js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
|
||||||
|
|
||||||
|
|||||||
220
WebRoot/issue_page.jsp
Normal file
220
WebRoot/issue_page.jsp
Normal file
@@ -0,0 +1,220 @@
|
|||||||
|
<%@ page language="java" contentType="text/html; charset=UTF-8"
|
||||||
|
pageEncoding="UTF-8"%>
|
||||||
|
<%@page import="java.sql.Connection"%>
|
||||||
|
<%@page import="java.sql.*"%>
|
||||||
|
<%@page import="java.sql.DriverManager"%>
|
||||||
|
<%-- <%@ page import="login.*" %> --%>
|
||||||
|
<!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">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<title>学生管理</title>
|
||||||
|
<link rel="stylesheet" href="css/manage.css" type="text/css">
|
||||||
|
<link rel="stylesheet" href="css/bootstrap.min.css" type="text/css">
|
||||||
|
<link rel="stylesheet" href="css/footer.css" type="text/css">
|
||||||
|
<script src="js/ie-emulation-modes-warning.js"></script>
|
||||||
|
<style type="text/css">
|
||||||
|
/* .jumbotron{
|
||||||
|
background:url(images/index3.jpg);
|
||||||
|
background-repeat:no-repeat;
|
||||||
|
height:100%;
|
||||||
|
background-size:100% 100%;
|
||||||
|
} */
|
||||||
|
.zczi {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.zczi2 {
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<%-- <%
|
||||||
|
java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
|
||||||
|
java.util.Date currentTime = new java.util.Date();//得到当前系统时间
|
||||||
|
|
||||||
|
String str_date1 = formatter.format(currentTime); //将日期时间格式化
|
||||||
|
String str_date2 = currentTime.toString(); //将Date型日期时间转换成字符串形式
|
||||||
|
%> --%>
|
||||||
|
<body onbeforeunload="window.location='JSPhandle/logout.jsp'">
|
||||||
|
<%
|
||||||
|
if (session.getAttribute("actualuser") == null) {
|
||||||
|
out.println(
|
||||||
|
"<script language=javascript>alert('登录超时 (1440 秒未活动)或未登录,请重新登录。');window.location.href='index.html'</script>");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Object user0 = session.getAttribute("actualuser");
|
||||||
|
/* out.println("欢迎"+user0);//输出当前session用户 */
|
||||||
|
%>
|
||||||
|
<%@ include file="module/top.jsp"%>
|
||||||
|
<div class="container">
|
||||||
|
<h1 class="heading_title_text text-center">发布信息</h1>
|
||||||
|
<div class="row">
|
||||||
|
<%@ include file="module/sidebar.jsp"%>
|
||||||
|
<div class="col-lg-1 col-md-1 hidden-xs"></div>
|
||||||
|
<div class="col-lg-9 col-md-9">
|
||||||
|
<div class="panel panel-primary">
|
||||||
|
<div class="panel-heading">新闻发布</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<div class="form-group">
|
||||||
|
<form method="post" action="news/add.jsp">
|
||||||
|
<div class="form-group">
|
||||||
|
|
||||||
|
<label>新闻题目</label> <input class="form-control" name="t1"
|
||||||
|
type="text" /> <label>新闻内容</label>
|
||||||
|
<textarea class="form-control" rows="10" name='t2'></textarea>
|
||||||
|
<input type="hidden" class="form-control" name="t3" type="text"
|
||||||
|
value="<%=user1%>" /> <br> <input type="submit"
|
||||||
|
class="btcss2 btn btn-default" value="增加" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="panel panel-primary">
|
||||||
|
<div class="panel-heading">公告发布</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<div class="form-group">
|
||||||
|
<form method="post" action="notice/add.jsp">
|
||||||
|
<div class="form-group">
|
||||||
|
<label>公告内容</label>
|
||||||
|
<textarea class="form-control" rows="3" name='a3'></textarea>
|
||||||
|
<input type="hidden" class="form-control" name="a4" type="text"
|
||||||
|
value="<%=user1%>" /> <br> <input type="submit"
|
||||||
|
class="btcss2 btn btn-default" value="增加" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="panel panel-primary">
|
||||||
|
<div class="panel-heading">新闻删除</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<form method="post" action="news/deleterun.jsp">
|
||||||
|
|
||||||
|
<%
|
||||||
|
try {
|
||||||
|
Class.forName("com.mysql.jdbc.Driver");
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
out.print("暂时无法访问");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Connection con;
|
||||||
|
Statement sql;
|
||||||
|
ResultSet rs;
|
||||||
|
con = DriverManager.getConnection(
|
||||||
|
"jdbc:mysql://localhost:3306/db_school?useUnicode=true&characterEncoding=utf-8", "root", "");
|
||||||
|
sql = con.createStatement();
|
||||||
|
String condition = null;
|
||||||
|
condition = "SELECT * FROM tb_news";
|
||||||
|
rs = sql.executeQuery(condition);
|
||||||
|
out.print("<Table class='table table-hover'>");
|
||||||
|
out.print("<TR>");
|
||||||
|
out.print("<TH ></TH >");
|
||||||
|
out.print("<TH >" + "新闻题目" + "</TH >");
|
||||||
|
out.print("<TH >" + "新闻内容" + "</TH >");
|
||||||
|
out.print("<TH >" + "新闻作者" + "</TH >");
|
||||||
|
out.print("<TH >" + "发布时间" + "</TH >");
|
||||||
|
out.print("</TR>");
|
||||||
|
while (rs.next()) //输出查询结果
|
||||||
|
{
|
||||||
|
out.print("<TR>");
|
||||||
|
out.print("<TD><input type='checkbox' class='checkbox' name='chk' id='chk' value=" + rs.getString(1)
|
||||||
|
+ "></TD >");
|
||||||
|
out.print("<TD>" + rs.getString(2) + "</TD>");
|
||||||
|
out.print("<TD>" + rs.getString(3) + "</TD>");
|
||||||
|
out.print("<TD>" + rs.getString(4) + "</TD>");
|
||||||
|
out.print("<TD>" + rs.getString(5) + "</TD>");
|
||||||
|
out.print("</TR>");
|
||||||
|
}
|
||||||
|
out.print("</Table>");
|
||||||
|
sql.close();
|
||||||
|
rs.close();
|
||||||
|
con.close();
|
||||||
|
} catch (SQLException e1) {
|
||||||
|
out.print("无法查询记录");
|
||||||
|
}
|
||||||
|
%>
|
||||||
|
<input type="hidden" name="tablename" value="tb_news" />
|
||||||
|
<input type="hidden" name="colname" value="newsid" />
|
||||||
|
<input
|
||||||
|
class="btn btn-danger pull-right" type="submit" value="删除新闻">
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="panel panel-primary">
|
||||||
|
<div class="panel-heading">公告删除</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<form method="post" action="news/deleterun.jsp">
|
||||||
|
|
||||||
|
<%
|
||||||
|
try {
|
||||||
|
Class.forName("com.mysql.jdbc.Driver");
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
out.print("暂时无法访问");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Connection con;
|
||||||
|
Statement sql;
|
||||||
|
ResultSet rs;
|
||||||
|
con = DriverManager.getConnection(
|
||||||
|
"jdbc:mysql://localhost:3306/db_school?useUnicode=true&characterEncoding=utf-8", "root", "");
|
||||||
|
sql = con.createStatement();
|
||||||
|
String condition = null;
|
||||||
|
condition = "SELECT * FROM notice";
|
||||||
|
rs = sql.executeQuery(condition);
|
||||||
|
out.print("<Table class='table table-hover'>");
|
||||||
|
out.print("<TR>");
|
||||||
|
out.print("<TH ></TH >");
|
||||||
|
out.print("<TH >" + "公告内容" + "</TH >");
|
||||||
|
out.print("<TH >" + "公告作者" + "</TH >");
|
||||||
|
out.print("<TH >" + "发布时间" + "</TH >");
|
||||||
|
out.print("</TR>");
|
||||||
|
while (rs.next()) //输出查询结果
|
||||||
|
{
|
||||||
|
out.print("<TR>");
|
||||||
|
out.print("<TD><input type='checkbox' class='checkbox' name='chk' id='chk' value=" + rs.getString(1)
|
||||||
|
+ "></TD >");
|
||||||
|
out.print("<TD>" + rs.getString(2) + "</TD>");
|
||||||
|
out.print("<TD>" + rs.getString(3) + "</TD>");
|
||||||
|
out.print("<TD>" + rs.getString(4) + "</TD>");
|
||||||
|
out.print("</TR>");
|
||||||
|
}
|
||||||
|
out.print("</Table>");
|
||||||
|
sql.close();
|
||||||
|
rs.close();
|
||||||
|
con.close();
|
||||||
|
} catch (SQLException e1) {
|
||||||
|
out.print("无法查询记录");
|
||||||
|
}
|
||||||
|
%>
|
||||||
|
<input type="hidden" name="tablename" value="notice" />
|
||||||
|
<input type="hidden" name="colname" value="公告编号" />
|
||||||
|
<input
|
||||||
|
class="btn btn-danger pull-right" type="submit" value="删除公告">
|
||||||
|
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<%@ include file="module/footer.jsp"%>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="js/jquery-1.11.2.min.js" type="text/javascript"></script>
|
||||||
|
<script src="js/bootstrap.js" type="text/javascript"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
19
WebRoot/js/jquery-1.3.2.js
vendored
Normal file
19
WebRoot/js/jquery-1.3.2.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -22,6 +22,13 @@ background-repeat:no-repeat;
|
|||||||
height:100%;
|
height:100%;
|
||||||
background-size:100% 100%;
|
background-size:100% 100%;
|
||||||
} */
|
} */
|
||||||
|
.zczi {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.zczi2 {
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
@@ -133,6 +140,168 @@ String str_date2 = currentTime.toString(); //将Date型日期时间转换成字
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="panel panel-primary">
|
||||||
|
<div class="panel-heading">新闻专栏</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<%
|
||||||
|
try {
|
||||||
|
Class.forName("com.mysql.jdbc.Driver");
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
out.print("驱动异常");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Connection con;
|
||||||
|
Statement sql;
|
||||||
|
ResultSet rs;
|
||||||
|
con = DriverManager.getConnection(
|
||||||
|
"jdbc:mysql://localhost:3306/db_school?useUnicode=true&characterEncoding=utf-8", "root", "");
|
||||||
|
sql = con.createStatement();
|
||||||
|
String condition = null;
|
||||||
|
condition = "SELECT newsid,newtitle,addTime FROM tb_news";
|
||||||
|
rs = sql.executeQuery(condition);
|
||||||
|
//String k1=rs.getString(1);
|
||||||
|
out.print("<table class='table table-striped'>");
|
||||||
|
out.print("<tr>");
|
||||||
|
out.print("<th>新闻标题</th>");
|
||||||
|
out.print("<th>新闻时间</th>");
|
||||||
|
out.print("<th>");
|
||||||
|
out.print("</tr>");
|
||||||
|
while (rs.next()) //输出查询结果
|
||||||
|
{
|
||||||
|
|
||||||
|
out.print("<tr>");
|
||||||
|
out.println("<TD><div>" + rs.getString(2) + "</div></TD>");
|
||||||
|
out.print("<TD><div>" + rs.getString(3) + "</div></TD>");
|
||||||
|
out.print("<TD><button type='button' class='btn btn-success pull-right' data-toggle='modal' data-target='.xw"
|
||||||
|
+ rs.getString(1) + "-example-modal-lg'>查看</button></TD>");
|
||||||
|
out.print("</tr>");
|
||||||
|
|
||||||
|
}
|
||||||
|
out.print("</table>");
|
||||||
|
con.close();
|
||||||
|
sql.close();
|
||||||
|
rs.close();
|
||||||
|
} catch (SQLException e1) {
|
||||||
|
out.print("无法查询记录");
|
||||||
|
}
|
||||||
|
%>
|
||||||
|
<!-- <a class="btn btn-default" href=add.html>增加新闻</a> <a
|
||||||
|
class="btn btn-default" href=updatechoose.jsp>修改新闻</a> <a
|
||||||
|
class="btn btn-default" href=deleteinput.jsp>删除新闻</a> -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<%
|
||||||
|
try {
|
||||||
|
Class.forName("com.mysql.jdbc.Driver");
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
out.print("暂时无法访问");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Connection con;
|
||||||
|
Statement sql;
|
||||||
|
ResultSet rs;
|
||||||
|
con = DriverManager.getConnection(
|
||||||
|
"jdbc:mysql://localhost:3306/db_school?useUnicode=true&characterEncoding=utf-8", "root", "");
|
||||||
|
sql = con.createStatement();
|
||||||
|
String condition = null;
|
||||||
|
condition = "SELECT * FROM tb_news";
|
||||||
|
rs = sql.executeQuery(condition);
|
||||||
|
|
||||||
|
while (rs.next()) //输出查询结果
|
||||||
|
{
|
||||||
|
%>
|
||||||
|
<div class="modal fade xw<%=rs.getString(1)%>-example-modal-lg"
|
||||||
|
tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
|
||||||
|
<div class="modal-dialog modal-lg" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal"
|
||||||
|
aria-label="Close">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<%
|
||||||
|
out.print("<h4 class='modal-title' id='gridSystemModalLabel'> " + rs.getString(2) + "</h4></div>");
|
||||||
|
|
||||||
|
out.println("<div class='modal-body'><p class='lead'>" + rs.getString(3) + "</p>");
|
||||||
|
|
||||||
|
out.println("<p>来自:" + rs.getString(4) + "</p>");
|
||||||
|
|
||||||
|
out.println("<p>" + rs.getString(5) + "</p>");
|
||||||
|
%>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-default "
|
||||||
|
data-dismiss="modal">关闭</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
con.close();
|
||||||
|
sql.close();
|
||||||
|
rs.close();
|
||||||
|
} catch (SQLException e1) {
|
||||||
|
out.print("无法查询记录");
|
||||||
|
}
|
||||||
|
%>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="panel panel-primary">
|
||||||
|
<!-- Default panel contents -->
|
||||||
|
<div class="panel-heading">公告</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<table class="table">
|
||||||
|
<tr>
|
||||||
|
<th><marquee direction=up height=100 id=m
|
||||||
|
onmouseout=m.start() onMouseOver=m.stop() scrollamount=2
|
||||||
|
align="center">
|
||||||
|
<font size=2>
|
||||||
|
<p>
|
||||||
|
<%
|
||||||
|
Connection con;
|
||||||
|
Statement sql;
|
||||||
|
ResultSet rs;
|
||||||
|
try {
|
||||||
|
Class.forName("com.mysql.jdbc.Driver");
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
out.print("驱动异常");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
con = DriverManager.getConnection(
|
||||||
|
"jdbc:mysql://localhost:3306/db_school?useUnicode=true&characterEncoding=utf-8", "root", "");
|
||||||
|
sql = con.createStatement();
|
||||||
|
String condition = null;
|
||||||
|
condition = "SELECT 公告内容,公告时间 FROM notice";
|
||||||
|
rs = sql.executeQuery(condition);
|
||||||
|
while (rs.next()) //输出查询结果
|
||||||
|
{
|
||||||
|
out.print("<div><span class='zczi2'>" + rs.getString(1) + "</span>");
|
||||||
|
|
||||||
|
out.print("<span class='zczi'>" + rs.getString(2) + "</span></div>");
|
||||||
|
out.println("<br/>");
|
||||||
|
out.println("<br/>");
|
||||||
|
}
|
||||||
|
con.close();
|
||||||
|
sql.close();
|
||||||
|
rs.close();
|
||||||
|
} catch (SQLException e1) {
|
||||||
|
out.print("无法查询记录");
|
||||||
|
}
|
||||||
|
%>
|
||||||
|
</p>
|
||||||
|
</font>
|
||||||
|
</marquee></th>
|
||||||
|
</table>
|
||||||
|
<!-- <a class="btn btn-default" href=add.html>增加公告</a> <a class="btn btn-default" href=selectupdate.jsp>修改公告</a> <a
|
||||||
|
class="btn btn-default" href=selectdelete.jsp>删除公告</a> -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<%@ include file="module/footer.jsp"%>
|
<%@ include file="module/footer.jsp"%>
|
||||||
|
|||||||
253
WebRoot/manage_issue_page.jsp
Normal file
253
WebRoot/manage_issue_page.jsp
Normal file
@@ -0,0 +1,253 @@
|
|||||||
|
<%@ page language="java" contentType="text/html; charset=UTF-8"
|
||||||
|
pageEncoding="UTF-8"%>
|
||||||
|
<%@page import="java.sql.Connection"%>
|
||||||
|
<%@page import="java.sql.*"%>
|
||||||
|
<%@page import="java.sql.DriverManager"%>
|
||||||
|
<%-- <%@ page import="login.*" %> --%>
|
||||||
|
<!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">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<title>学生管理</title>
|
||||||
|
<link rel="stylesheet" href="css/manage.css" type="text/css">
|
||||||
|
<link rel="stylesheet" href="css/bootstrap.min.css" type="text/css">
|
||||||
|
<link rel="stylesheet" href="css/footer.css" type="text/css">
|
||||||
|
<script src="js/ie-emulation-modes-warning.js"></script>
|
||||||
|
<style type="text/css">
|
||||||
|
/* .jumbotron{
|
||||||
|
background:url(images/index3.jpg);
|
||||||
|
background-repeat:no-repeat;
|
||||||
|
height:100%;
|
||||||
|
background-size:100% 100%;
|
||||||
|
} */
|
||||||
|
.zczi {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.zczi2 {
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<%-- <%
|
||||||
|
java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
|
||||||
|
java.util.Date currentTime = new java.util.Date();//得到当前系统时间
|
||||||
|
|
||||||
|
String str_date1 = formatter.format(currentTime); //将日期时间格式化
|
||||||
|
String str_date2 = currentTime.toString(); //将Date型日期时间转换成字符串形式
|
||||||
|
%> --%>
|
||||||
|
<body onbeforeunload="window.location='JSPhandle/logout.jsp'">
|
||||||
|
<%
|
||||||
|
if (session.getAttribute("actualuser") == null) {
|
||||||
|
out.println(
|
||||||
|
"<script language=javascript>alert('登录超时 (1440 秒未活动)或未登录,请重新登录。');window.location.href='index.html'</script>");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Object user0 = session.getAttribute("actualuser");
|
||||||
|
/* out.println("欢迎"+user0);//输出当前session用户 */
|
||||||
|
%>
|
||||||
|
<%@ include file="module/top.jsp"%>
|
||||||
|
<div class="container">
|
||||||
|
<h1 class="heading_title_text text-center">VANTEN信息管理系统</h1>
|
||||||
|
<div class="row">
|
||||||
|
<%@ include file="module/sidebar.jsp"%>
|
||||||
|
<%-- <%!public String getIpAddr(HttpServletRequest request) {
|
||||||
|
String ip = request.getHeader("x-forwarded-for");
|
||||||
|
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||||
|
ip = request.getHeader("Proxy-Client-IP");
|
||||||
|
}
|
||||||
|
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||||
|
ip = request.getHeader("WL-Proxy-Client-IP");
|
||||||
|
}
|
||||||
|
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||||
|
ip = request.getRemoteAddr();
|
||||||
|
}
|
||||||
|
return ip;
|
||||||
|
}%>
|
||||||
|
<%
|
||||||
|
counter = getIpAddr(request);
|
||||||
|
try {
|
||||||
|
sql = conn.prepareStatement("update counter set visitCount=visitCount+1");
|
||||||
|
int rtn = sql.executeUpdate();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
sql = conn.prepareStatement("insert into iplist(IP,times,userName)values(?,?,?)");
|
||||||
|
sql.setString(1, counter);
|
||||||
|
sql.setString(2, str_date1);
|
||||||
|
sql.setString(3, (String)user0);
|
||||||
|
int rtn = sql.executeUpdate();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
%> --%>
|
||||||
|
<%-- <%=counter %> --%>
|
||||||
|
<div class="col-lg-1 col-md-1 hidden-xs"></div>
|
||||||
|
<div class="col-lg-9 col-md-9">
|
||||||
|
<!-- <div id="carousel-example-generic" class="carousel slide"
|
||||||
|
data-ride="carousel">
|
||||||
|
Indicators
|
||||||
|
<ol class="carousel-indicators">
|
||||||
|
<li data-target="#carousel-example-generic" data-slide-to="0"
|
||||||
|
class="active"></li>
|
||||||
|
<li data-target="#carousel-example-generic" data-slide-to="1"></li>
|
||||||
|
<li data-target="#carousel-example-generic" data-slide-to="2"></li>
|
||||||
|
</ol>
|
||||||
|
|
||||||
|
Wrapper for slides
|
||||||
|
<div class="carousel-inner" role="listbox">
|
||||||
|
<div class="item active">
|
||||||
|
<img src="images/index1.jpg" alt="...">
|
||||||
|
<div class="carousel-caption">...</div>
|
||||||
|
</div>
|
||||||
|
<div class="item">
|
||||||
|
<img src="images/index3.jpg" alt="...">
|
||||||
|
<div class="carousel-caption">...</div>
|
||||||
|
</div>
|
||||||
|
...
|
||||||
|
</div>
|
||||||
|
|
||||||
|
Controls
|
||||||
|
<a class="left carousel-control" href="#carousel-example-generic"
|
||||||
|
role="button" data-slide="prev"> <span
|
||||||
|
class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
|
||||||
|
<span class="sr-only">Previous</span>
|
||||||
|
</a> <a class="right carousel-control" href="#carousel-example-generic"
|
||||||
|
role="button" data-slide="next"> <span
|
||||||
|
class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
|
||||||
|
<span class="sr-only">Next</span>
|
||||||
|
</a>
|
||||||
|
</div> -->
|
||||||
|
<div class="jumbotron">
|
||||||
|
<h1 class="text-center">欢迎访问</h1>
|
||||||
|
<p class="text-center">15信管2班</p>
|
||||||
|
<!-- Large modal -->
|
||||||
|
<button type="button" class="btn btn-primary" data-toggle="modal"
|
||||||
|
data-target=".bs-example-modal-lg">按按试试</button>
|
||||||
|
|
||||||
|
<div class="modal fade bs-example-modal-lg" tabindex="-1"
|
||||||
|
role="dialog" aria-labelledby="myLargeModalLabel">
|
||||||
|
<div class="modal-dialog modal-lg" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<img src="images/index2.png" alt="图片不见了"
|
||||||
|
style="display:block;width:100%;" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="panel panel-primary">
|
||||||
|
<div class="panel-heading">新闻专栏</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<%
|
||||||
|
try {
|
||||||
|
Class.forName("com.mysql.jdbc.Driver");
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
out.print("驱动异常");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Connection con;
|
||||||
|
Statement sql;
|
||||||
|
ResultSet rs;
|
||||||
|
con = DriverManager.getConnection(
|
||||||
|
"jdbc:mysql://localhost:3306/db_school?useUnicode=true&characterEncoding=utf-8", "root", "");
|
||||||
|
sql = con.createStatement();
|
||||||
|
String condition = null;
|
||||||
|
condition = "SELECT newsid,newtitle,addTime FROM tb_news";
|
||||||
|
rs = sql.executeQuery(condition);
|
||||||
|
//String k1=rs.getString(1);
|
||||||
|
out.print("<table class='table table-striped'>");
|
||||||
|
out.print("<tr>");
|
||||||
|
out.print("<th>新闻标题</th>");
|
||||||
|
out.print("<th>新闻时间</th>");
|
||||||
|
out.print("<th>");
|
||||||
|
out.print("</tr>");
|
||||||
|
while (rs.next()) //输出查询结果
|
||||||
|
{
|
||||||
|
|
||||||
|
out.print("<tr>");
|
||||||
|
out.println("<TD><div>" + rs.getString(2) + "</div></TD>");
|
||||||
|
out.print("<TD><div>" + rs.getString(3) + "</div></TD>");
|
||||||
|
out.print("<TD><div><strong><a href='show.jsp?newsid=" + rs.getString(1)
|
||||||
|
+ "' >查看</a></div></TD>");
|
||||||
|
out.print("</tr>");
|
||||||
|
|
||||||
|
}
|
||||||
|
out.print("</table>");
|
||||||
|
con.close();
|
||||||
|
sql.close();
|
||||||
|
rs.close();
|
||||||
|
} catch (SQLException e1) {
|
||||||
|
out.print("无法查询记录");
|
||||||
|
}
|
||||||
|
%>
|
||||||
|
<a class="btn btn-default" href=add.html>增加新闻</a> <a
|
||||||
|
class="btn btn-default" href=updatechoose.jsp>修改新闻</a> <a
|
||||||
|
class="btn btn-default" href=deleteinput.jsp>删除新闻</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="panel panel-primary">
|
||||||
|
<!-- Default panel contents -->
|
||||||
|
<div class="panel-heading">公告</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<table class="table">
|
||||||
|
<tr>
|
||||||
|
<th><marquee direction=up height=100
|
||||||
|
id=m onmouseout=m.start() onMouseOver=m.stop()
|
||||||
|
scrollamount=2 align="center">
|
||||||
|
<font size=2>
|
||||||
|
<p>
|
||||||
|
<%
|
||||||
|
Connection con;
|
||||||
|
Statement sql;
|
||||||
|
ResultSet rs;
|
||||||
|
try {
|
||||||
|
Class.forName("com.mysql.jdbc.Driver");
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
out.print("驱动异常");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
con = DriverManager.getConnection(
|
||||||
|
"jdbc:mysql://localhost:3306/db_school?useUnicode=true&characterEncoding=utf-8", "root", "");
|
||||||
|
sql = con.createStatement();
|
||||||
|
String condition = null;
|
||||||
|
condition = "SELECT 公告内容,公告时间 FROM notice";
|
||||||
|
rs = sql.executeQuery(condition);
|
||||||
|
while (rs.next()) //输出查询结果
|
||||||
|
{
|
||||||
|
out.print("<div><span class='zczi2'>" + rs.getString(1) + "</span>");
|
||||||
|
|
||||||
|
out.print("<span class='zczi'>" + rs.getString(2) + "</span></div>");
|
||||||
|
out.println("<br/>");
|
||||||
|
out.println("<br/>");
|
||||||
|
}
|
||||||
|
con.close();
|
||||||
|
sql.close();
|
||||||
|
rs.close();
|
||||||
|
} catch (SQLException e1) {
|
||||||
|
out.print("无法查询记录");
|
||||||
|
}
|
||||||
|
%>
|
||||||
|
</p>
|
||||||
|
</font>
|
||||||
|
</marquee></th>
|
||||||
|
</table>
|
||||||
|
<a class="btn btn-default" href=add.html>增加公告</a> <a class="btn btn-default" href=selectupdate.jsp>修改公告</a> <a
|
||||||
|
class="btn btn-default" href=selectdelete.jsp>删除公告</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<%@ include file="module/footer.jsp"%>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="js/jquery-1.11.2.min.js" type="text/javascript"></script>
|
||||||
|
<script src="js/bootstrap.js" type="text/javascript"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -45,8 +45,7 @@
|
|||||||
<h3>管理员档案</h3>
|
<h3>管理员档案</h3>
|
||||||
<li class="active"><a href="add_admin.jsp">添加管理员<span
|
<li class="active"><a href="add_admin.jsp">添加管理员<span
|
||||||
class="sr-only">(current)</span></a></li>
|
class="sr-only">(current)</span></a></li>
|
||||||
<li class="active"><a href="add_docFile.jsp">添加档案<span
|
<li class="active"><a href="add_docFile.jsp">添加管理员档案</a></li>
|
||||||
class="sr-only">(current)</span></a></li>
|
|
||||||
<li><a href="show_admin.jsp">查看管理员</a></li>
|
<li><a href="show_admin.jsp">查看管理员</a></li>
|
||||||
<li><a href="exhibition_admin.jsp">展示管理员</a></li>
|
<li><a href="exhibition_admin.jsp">展示管理员</a></li>
|
||||||
<li><a href="change_admin.jsp">修改管理员</a></li>
|
<li><a href="change_admin.jsp">修改管理员</a></li>
|
||||||
@@ -67,6 +66,13 @@
|
|||||||
<li><a href="index.jsp">论坛</a></li>
|
<li><a href="index.jsp">论坛</a></li>
|
||||||
<li><a href="x2_resource.jsp">信2资源站(维护中)</a></li>
|
<li><a href="x2_resource.jsp">信2资源站(维护中)</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
<ul class="nav nav-sidebar text-center">
|
||||||
|
<h3>个人中心</h3>
|
||||||
|
<li ><a href="add_docFile.jsp">添加个人档案</a></li>
|
||||||
|
<li><a href="index.jsp">查看个人档案</a></li>
|
||||||
|
<li><a href="x2_resource.jsp">删除个人档案</a></li>
|
||||||
|
<li><a href="issue_page.jsp">发布信息</a></li>
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<script src="../js/jquery-1.11.2.min.js" type="text/javascript"></script>
|
<script src="../js/jquery-1.11.2.min.js" type="text/javascript"></script>
|
||||||
<script src="../js/bootstrap.js" type="text/javascript"></script>
|
<script src="../js/bootstrap.js" type="text/javascript"></script>
|
||||||
|
|||||||
46
WebRoot/news/add.html
Normal file
46
WebRoot/news/add.html
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
|
||||||
|
<meta http-equiv="Content-Language" content="zh-CN">
|
||||||
|
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
|
||||||
|
|
||||||
|
|
||||||
|
<meta name="viewport"
|
||||||
|
content="width=100%; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />
|
||||||
|
</head>
|
||||||
|
<style>
|
||||||
|
h1 {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
height: 70px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.center {
|
||||||
|
width: 500px;
|
||||||
|
height: 200px;
|
||||||
|
margin: auto;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<body>
|
||||||
|
<form method="post" action="add.jsp">
|
||||||
|
<h1>新闻发布</h1>
|
||||||
|
<div class="center">
|
||||||
|
|
||||||
|
<font>新闻题目</font><input name="t1" size="20" type="text"
|
||||||
|
style="width: 317px; " /> <br /> <br />
|
||||||
|
<p>新闻内容</p>
|
||||||
|
<textarea rows="20" name='t2' cols="60"></textarea>
|
||||||
|
<br /> <br /> <font>新闻来源</font><input name="t3" size="10"
|
||||||
|
type="text" style="width: 290px; " /> <br /> <br /> <input
|
||||||
|
type="submit" class="btcss2" value="增加" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</head>
|
||||||
|
</HTML>
|
||||||
68
WebRoot/news/add.jsp
Normal file
68
WebRoot/news/add.jsp
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
<%@ page contentType="text/html;charset=UTF-8"%>
|
||||||
|
<%@ page import="java.sql.*"%>
|
||||||
|
<%!//处理字符串的方法:
|
||||||
|
|
||||||
|
public String codeString(String s) {
|
||||||
|
String str = s;
|
||||||
|
try {
|
||||||
|
str = new String(s.getBytes("ISO8859-1"), "UTF-8");
|
||||||
|
return str;
|
||||||
|
} catch (Exception e) {
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
}%>
|
||||||
|
<HTML>
|
||||||
|
<head>
|
||||||
|
|
||||||
|
<title></title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<BODY>
|
||||||
|
<%
|
||||||
|
String k1 = request.getParameter("t1");
|
||||||
|
if (k1 == null) {
|
||||||
|
k1 = "";
|
||||||
|
}
|
||||||
|
k1 = codeString(k1);
|
||||||
|
String k2 = request.getParameter("t2");
|
||||||
|
if (k2 == null) {
|
||||||
|
k2 = "";
|
||||||
|
}
|
||||||
|
k2 = codeString(k2);
|
||||||
|
String k3 = request.getParameter("t3");
|
||||||
|
if (k3 == null) {
|
||||||
|
k3 = "";
|
||||||
|
}
|
||||||
|
k3 = codeString(k3);
|
||||||
|
//String k4=request.getParameter("a4"); if(k4==null){k4="";} k4=codeString(k4);
|
||||||
|
//String k5=request.getParameter("a5"); if(k5==null){k5="";} k5=codeString(k5);
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
Class.forName("com.mysql.jdbc.Driver");
|
||||||
|
} catch (ClassNotFoundException event) {
|
||||||
|
out.print("驱动异常");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Connection con = null;
|
||||||
|
Statement sql = null;
|
||||||
|
String condition = null;
|
||||||
|
condition = "INSERT INTO tb_news(newtitle,newstext,newsfrom) VALUES('" + k1 + "','" + k2 + "','" + k3
|
||||||
|
+ "')";
|
||||||
|
con = DriverManager.getConnection(
|
||||||
|
"jdbc:mysql://localhost:3306/db_school?useUnicode=true&characterEncoding=utf-8", "root", "");
|
||||||
|
sql = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
|
||||||
|
sql.executeUpdate(condition);
|
||||||
|
out.print("新闻发布成功!");
|
||||||
|
out.print("2秒后自动返回...");
|
||||||
|
con.close();
|
||||||
|
sql.close();
|
||||||
|
response.setHeader("refresh", "2;url=../mainframe.jsp");
|
||||||
|
} catch (SQLException event) {
|
||||||
|
out.print("发布新闻失败");
|
||||||
|
response.setHeader("refresh", "5;url=../mainframe.jsp");
|
||||||
|
out.print("5秒后自动返回...");
|
||||||
|
}
|
||||||
|
%>
|
||||||
|
</BODY>
|
||||||
|
</HTML>
|
||||||
64
WebRoot/news/deleteinput.jsp
Normal file
64
WebRoot/news/deleteinput.jsp
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
<%@ page contentType="text/html;charset=UTF-8"%>
|
||||||
|
<%@ page import="java.sql.*"%>
|
||||||
|
<%!//处理字符串的方法:
|
||||||
|
public String codeString(String s) {
|
||||||
|
String str = s;
|
||||||
|
try {
|
||||||
|
byte b[] = str.getBytes("ISO-8859-1");
|
||||||
|
str = new String(b);
|
||||||
|
return str;
|
||||||
|
} catch (Exception e) {
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
}%>
|
||||||
|
<HTML>
|
||||||
|
<BODY>
|
||||||
|
<%
|
||||||
|
try {
|
||||||
|
Class.forName("com.mysql.jdbc.Driver");
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
out.print("暂时无法访问");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Connection con;
|
||||||
|
Statement sql;
|
||||||
|
ResultSet rs;
|
||||||
|
con = DriverManager.getConnection("jdbc:mysql://localhost/news", "root", "123456");
|
||||||
|
sql = con.createStatement();
|
||||||
|
String condition = null;
|
||||||
|
condition = "SELECT * FROM newstable1";
|
||||||
|
rs = sql.executeQuery(condition);
|
||||||
|
out.print("<Table Border align='center'>");
|
||||||
|
out.print("<TR>");
|
||||||
|
out.print("<TH width=100 >" + "新闻编号");
|
||||||
|
out.print("<TH width=100 >" + "新闻题目");
|
||||||
|
out.print("<TH width=200 >" + "新闻内容");
|
||||||
|
out.print("<TH width=100 >" + "新闻作者");
|
||||||
|
out.print("<TH width=100 >" + "新闻时间");
|
||||||
|
out.print("</TR>");
|
||||||
|
while (rs.next()) //输出查询结果
|
||||||
|
{
|
||||||
|
out.print("<TR>");
|
||||||
|
out.print("<TD height=100 vertical-align:top>" + rs.getString(1) + "</TD>");
|
||||||
|
out.print("<TD height=100 vertical-align:top>" + rs.getString(2) + "</TD>");
|
||||||
|
out.print("<TD height=100 vertical-align:top>" + rs.getString(3) + "</TD>");
|
||||||
|
out.print("<TD height=100 vertical-align:top>" + rs.getString(4) + "</TD>");
|
||||||
|
out.print("<TD height=100 vertical-align:top>" + rs.getString(5) + "</TD>");
|
||||||
|
out.print("</TR>");
|
||||||
|
}
|
||||||
|
out.print("</Table>");
|
||||||
|
sql.close();
|
||||||
|
rs.close();
|
||||||
|
con.close();
|
||||||
|
} catch (SQLException e1) {
|
||||||
|
out.print("无法查询记录");
|
||||||
|
}
|
||||||
|
%>
|
||||||
|
<form method="post" action="deleterun.jsp">
|
||||||
|
<div align='center'>
|
||||||
|
请输入你要删除的新闻编号<input name="t1" size="11" type="text"> <input
|
||||||
|
type="submit" class="btcss2" value="提交删除" /><br />
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</BODY>
|
||||||
|
</HTML>
|
||||||
58
WebRoot/news/deleterun.jsp
Normal file
58
WebRoot/news/deleterun.jsp
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
<%@ page contentType="text/html;charset=UTf-8"%>
|
||||||
|
<%@ page import="java.sql.*"%>
|
||||||
|
<%!//处理字符串的方法:
|
||||||
|
public String codeString(String s) {
|
||||||
|
String str = s;
|
||||||
|
try {
|
||||||
|
byte b[] = str.getBytes("ISO-8859-1");
|
||||||
|
str = new String(b);
|
||||||
|
return str;
|
||||||
|
} catch (Exception e) {
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
}%>
|
||||||
|
<HTML>
|
||||||
|
<head>
|
||||||
|
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
|
||||||
|
<meta http-equiv="refresh" content="2;url=../issue_page.jsp">
|
||||||
|
<title></title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<BODY>
|
||||||
|
<%
|
||||||
|
request.setCharacterEncoding("utf-8");
|
||||||
|
String s[] = request.getParameterValues("chk");
|
||||||
|
String table_name = request.getParameter("tablename");
|
||||||
|
String colname = request.getParameter("colname");
|
||||||
|
|
||||||
|
try {
|
||||||
|
Class.forName("com.mysql.jdbc.Driver");
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
out.print("驱动异常");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Connection con = null;
|
||||||
|
Statement sql = null;
|
||||||
|
con = DriverManager.getConnection(
|
||||||
|
"jdbc:mysql://localhost/db_school?useUnicode=true&characterEncoding=utf-8", "root", "");
|
||||||
|
sql = con.createStatement();
|
||||||
|
if (s != null) {
|
||||||
|
for (int i = 0; i < s.length; i++) {
|
||||||
|
String text = "DELETE from " + table_name + " WHERE " + colname + " = '" + s[i] + "'";
|
||||||
|
sql.executeUpdate(text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sql.close();
|
||||||
|
con.close();
|
||||||
|
out.print("成功删除");
|
||||||
|
response.setHeader("refresh", "2;url=../issue_page.jsp");
|
||||||
|
out.print("2秒后自动返回...");
|
||||||
|
} catch (SQLException event) {
|
||||||
|
out.print("删除新闻失败,以下信息供开发者查看,查看传值是否正常");
|
||||||
|
/*response.setHeader("refresh", "5;url=../issue_page.jsp"); */
|
||||||
|
out.print(colname);
|
||||||
|
out.print(table_name);
|
||||||
|
}
|
||||||
|
%>
|
||||||
|
</BODY>
|
||||||
|
</HTML>
|
||||||
61
WebRoot/news/index.jsp
Normal file
61
WebRoot/news/index.jsp
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
<%@ page contentType="text/html;charset=UTF-8" %>
|
||||||
|
<%@ page import="java.sql.*" %>
|
||||||
|
<%! //处理字符串的方法:
|
||||||
|
public String codeString(String s)
|
||||||
|
{ String str=s;
|
||||||
|
try{byte b[]=str.getBytes("ISO-8859-1");
|
||||||
|
str=new String(b); return str;
|
||||||
|
} catch(Exception e) { return str; }
|
||||||
|
}
|
||||||
|
%>
|
||||||
|
|
||||||
|
<HTML>
|
||||||
|
<div align=center>
|
||||||
|
<b>新闻发布专栏</b>
|
||||||
|
</div>
|
||||||
|
<p></p>
|
||||||
|
<center>
|
||||||
|
|
||||||
|
<%
|
||||||
|
Connection con;
|
||||||
|
Statement sql;
|
||||||
|
ResultSet rs;
|
||||||
|
try{Class.forName("com.mysql.jdbc.Driver"); }
|
||||||
|
catch(ClassNotFoundException e){out.print("驱动异常");}
|
||||||
|
try {
|
||||||
|
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/db_school?useUnicode=true&characterEncoding=utf-8","root","");
|
||||||
|
sql=con.createStatement();
|
||||||
|
String condition=null;
|
||||||
|
condition="SELECT newsid,newtitle,addTime FROM newstable";
|
||||||
|
rs=sql.executeQuery(condition);
|
||||||
|
//String k1=rs.getString(1);
|
||||||
|
out.print("<table Border align='center' >");
|
||||||
|
out.print("<tr>");
|
||||||
|
out.print("<th>新闻标题</th>");
|
||||||
|
out.print("<th>新闻时间</th>");
|
||||||
|
out.print("<th>");
|
||||||
|
out.print("</tr>");
|
||||||
|
while(rs.next()) //输出查询结果
|
||||||
|
{
|
||||||
|
|
||||||
|
out.print("<tr>");
|
||||||
|
out.println("<TD><div align='center' class='zczi'>"+rs.getString(2)+"</div></TD>");
|
||||||
|
out.print("<TD><div align='right' class='zczi'>"+rs.getString(3)+"</div></TD>");
|
||||||
|
out.print("<TD><div align='center'><strong><a href='show.jsp?newsid="+rs.getString(1)+"' class='zczi'>查看</a></div></TD>");
|
||||||
|
out.print("</tr>");
|
||||||
|
|
||||||
|
}
|
||||||
|
out.print("</table>");
|
||||||
|
con.close();
|
||||||
|
}
|
||||||
|
catch(SQLException e1) {out.print("无法查询记录");} %></p>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<center>
|
||||||
|
|
||||||
|
<a href=add.html>增加新闻</a>
|
||||||
|
<a href=updatechoose.jsp>修改新闻</a>
|
||||||
|
<a href=deleteinput.jsp>删除新闻</a>
|
||||||
|
<BODY >
|
||||||
|
</BODY>
|
||||||
|
</HTML>
|
||||||
51
WebRoot/news/show.jsp
Normal file
51
WebRoot/news/show.jsp
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
<%@ page contentType="text/html;charset=UTF-8" %>
|
||||||
|
<%@ page import="java.sql.*" %>
|
||||||
|
<%! //处理字符串的方法:
|
||||||
|
public String codeString(String s)
|
||||||
|
{ String str=s;
|
||||||
|
try{str=new String(s.getBytes("ISO8859-1"),"UTF-8");
|
||||||
|
return str;
|
||||||
|
} catch(Exception e) { return str; }
|
||||||
|
}
|
||||||
|
%>
|
||||||
|
<HTML>
|
||||||
|
<BODY>
|
||||||
|
<%
|
||||||
|
request.setCharacterEncoding("utf-8");
|
||||||
|
String k1=request.getParameter("newsid"); if(k1==null){k1="";}
|
||||||
|
|
||||||
|
Connection con;
|
||||||
|
Statement sql;
|
||||||
|
ResultSet rs;
|
||||||
|
try{Class.forName("com.mysql.jdbc.Driver");
|
||||||
|
} catch(ClassNotFoundException e){out.print("暂时无法访问");}
|
||||||
|
try {
|
||||||
|
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/db_school?useUnicode=true&characterEncoding=utf-8", "root", "");
|
||||||
|
sql=con.createStatement();
|
||||||
|
String condition=null;
|
||||||
|
condition="SELECT newtitle,newstext,newsfrom,addTime FROM tb_news";
|
||||||
|
rs=sql.executeQuery(condition);
|
||||||
|
|
||||||
|
while(rs.next()) //输出查询结果
|
||||||
|
{
|
||||||
|
|
||||||
|
out.print("<div align=center>新闻题目: "+rs.getString(1)+"</div>");
|
||||||
|
|
||||||
|
out.println("<br/>");
|
||||||
|
out.println("<div align=center>新闻内容:"+rs.getString(2)+"</div>");
|
||||||
|
|
||||||
|
out.println("<div align=center>新闻来源:"+rs.getString(3)+"</div>");
|
||||||
|
|
||||||
|
out.println("<div align=center>新闻时间:"+rs.getString(4)+"</div>");
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
con.close();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
catch(SQLException e1) {out.print("无法查询记录");}
|
||||||
|
%>
|
||||||
|
|
||||||
49
WebRoot/news/updatechoose.jsp
Normal file
49
WebRoot/news/updatechoose.jsp
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
<%@ page contentType="text/html;charset=UTF-8" %>
|
||||||
|
<%@ page import="java.sql.*" %>
|
||||||
|
|
||||||
|
<HTML>
|
||||||
|
<BODY>
|
||||||
|
<%
|
||||||
|
|
||||||
|
Connection con;
|
||||||
|
Statement sql;
|
||||||
|
ResultSet rs;
|
||||||
|
try{Class.forName("com.mysql.jdbc.Driver");
|
||||||
|
} catch(ClassNotFoundException e){out.print("暂时无法访问");}
|
||||||
|
try {
|
||||||
|
con=DriverManager.getConnection("jdbc:mysql://localhost/news","root","123456");
|
||||||
|
sql=con.createStatement();
|
||||||
|
String condition=null;
|
||||||
|
condition="SELECT * FROM newstable1";
|
||||||
|
rs=sql.executeQuery(condition);
|
||||||
|
out.print("<Table Border align='center'>");
|
||||||
|
out.print("<TR>");
|
||||||
|
out.print("<TH width=100 >"+"新闻编号");
|
||||||
|
out.print("<TH width=100 >"+"新闻题目");
|
||||||
|
out.print("<TH width=100 >"+"新闻内容");
|
||||||
|
out.print("<TH width=100 >"+"新闻作者");
|
||||||
|
out.print("<TH width=100 >"+"新闻时间");
|
||||||
|
out.print("</TR>");
|
||||||
|
while(rs.next()) //输出查询结果
|
||||||
|
{ out.print("<TR>");
|
||||||
|
out.print("<TD height=100 vertical-align:top>"+rs.getString(1)+"</TD>");
|
||||||
|
out.print("<TD height=100 vertical-align:top>"+rs.getString(2)+"</TD>");
|
||||||
|
out.print("<TD height=200 vertical-align:top>"+rs.getString(3)+"</TD>");
|
||||||
|
out.print("<TD height=100 vertical-align:top>"+rs.getString(4)+"</TD>");
|
||||||
|
out.print("<TD height=100 vertical-align:top>"+rs.getString(5)+"</TD>");
|
||||||
|
out.print("</TR>") ;
|
||||||
|
}
|
||||||
|
out.print("</Table>");
|
||||||
|
|
||||||
|
con.close();
|
||||||
|
}
|
||||||
|
catch(SQLException e1) {out.print("无法查询记录");}
|
||||||
|
%>
|
||||||
|
<form method="post" action="updeterun.jsp">
|
||||||
|
请输入你要修改的新闻编号<br /><input name="t1" size="11" ><br><br/>
|
||||||
|
请输入你要修改的新闻内容:<br /><textarea name="t2" cols="40" rows="5" type="text" style="height: 255px; width: 727px; "></textarea>
|
||||||
|
<br /><br />
|
||||||
|
<input type="submit" class="btcss2" value="提交修改" /><br />
|
||||||
|
</form>
|
||||||
|
</BODY>
|
||||||
|
</HTML>
|
||||||
43
WebRoot/news/updeterun.jsp
Normal file
43
WebRoot/news/updeterun.jsp
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
<%@ page contentType="text/html;charset=UTf-8" %>
|
||||||
|
<%@ page import="java.sql.*" %>
|
||||||
|
<%--<%! //处理字符串的方法:
|
||||||
|
public String codeString(String s)
|
||||||
|
{ String str=s;
|
||||||
|
try{
|
||||||
|
str=new String(s.getBytes("ISO8859-1"),"UTF-8");
|
||||||
|
return str;
|
||||||
|
} catch(Exception e) { return str; }
|
||||||
|
}
|
||||||
|
--%>
|
||||||
|
<HTML>
|
||||||
|
|
||||||
|
<BODY>
|
||||||
|
<%
|
||||||
|
request.setCharacterEncoding("utf-8");
|
||||||
|
String k1=request.getParameter("t1"); //if(k1==null){k1="";} k1=codeString(k1);
|
||||||
|
String k2=request.getParameter("t2"); //if(k1==null){k2="";} k1=codeString(k2);
|
||||||
|
out.print(k1);
|
||||||
|
out.print(k2);
|
||||||
|
Connection con=null;
|
||||||
|
Statement sql=null;
|
||||||
|
ResultSet rs=null;
|
||||||
|
try{Class.forName("com.mysql.jdbc.Driver");}catch(ClassNotFoundException event){out.print("暂时无法访问");}
|
||||||
|
String condition=null;
|
||||||
|
condition="UPDATE newstable1 SET newstext='"+k2+"' WHERE newsid='"+k1+"' ";
|
||||||
|
try {
|
||||||
|
con=DriverManager.getConnection("jdbc:mysql://localhost/news","root","123456");
|
||||||
|
sql=con.createStatement();
|
||||||
|
sql.executeUpdate(condition);
|
||||||
|
out.print(k2);
|
||||||
|
out.print("成功修改!</a>");
|
||||||
|
response.setHeader("refresh","5;url=index.jsp");
|
||||||
|
out.print("5秒后自动返回...");
|
||||||
|
sql.close();
|
||||||
|
con.close();
|
||||||
|
} catch(SQLException event)
|
||||||
|
{
|
||||||
|
out.print("修改失败");
|
||||||
|
response.setHeader("refresh","5;url=index.jsp");
|
||||||
|
out.print("5秒后自动返回...");}
|
||||||
|
%>
|
||||||
|
</BODY></HTML>
|
||||||
44
WebRoot/notice/add.html
Normal file
44
WebRoot/notice/add.html
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
|
||||||
|
<meta http-equiv="Content-Language" content="zh-CN">
|
||||||
|
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
|
||||||
|
|
||||||
|
<title>公告</title>
|
||||||
|
<meta name="viewport"
|
||||||
|
content="width=100%; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />
|
||||||
|
</head>
|
||||||
|
<style>
|
||||||
|
h1 {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
height: 70px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.center {
|
||||||
|
width: 500px;
|
||||||
|
height: 200px;
|
||||||
|
margin: auto;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<body>
|
||||||
|
<form method="post" action="add.jsp">
|
||||||
|
<h1>增加公告</h1>
|
||||||
|
<div class="center">
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<p>公告内容</p>
|
||||||
|
<textarea name="a3" rows="8" name='t2' cols="20"
|
||||||
|
" style="width: 375px; "></textarea>
|
||||||
|
<br /> <br /> <font>公告作者</font><input name="a4" size="10"
|
||||||
|
type="text" style="width: 299px; " /> <br /> <input type="submit"
|
||||||
|
class="btcss2" value="增加" />
|
||||||
|
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</head>
|
||||||
|
</html>
|
||||||
50
WebRoot/notice/add.jsp
Normal file
50
WebRoot/notice/add.jsp
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
<%@ page contentType="text/html;charset=UTF-8"%>
|
||||||
|
<%@ page import="java.sql.*"%>
|
||||||
|
|
||||||
|
<HTML>
|
||||||
|
|
||||||
|
<BODY>
|
||||||
|
<%
|
||||||
|
request.setCharacterEncoding("utf-8");
|
||||||
|
// String k2=request.getParameter("a2"); if(k2==null){k2="";} k2=codeString(k2);
|
||||||
|
String k3 = request.getParameter("a3");
|
||||||
|
if (k3 == null || k3 == "") {
|
||||||
|
k3 = null;
|
||||||
|
}
|
||||||
|
String k4 = request.getParameter("a4");
|
||||||
|
if (k4 == null) {
|
||||||
|
k4 = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Class.forName("com.mysql.jdbc.Driver");
|
||||||
|
} catch (ClassNotFoundException event) {
|
||||||
|
out.print("驱动异常");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
if (k3 == null) {
|
||||||
|
out.print("公告内容不能为空");
|
||||||
|
response.setHeader("refresh", "5;url=../issue_page.jsp");
|
||||||
|
} else {
|
||||||
|
Connection con = null;
|
||||||
|
Statement sql = null;
|
||||||
|
String condition = null;
|
||||||
|
condition = "INSERT INTO notice(公告内容,公告作者) VALUES('" + k3 + "','" + k4 + "')";
|
||||||
|
con = DriverManager.getConnection("jdbc:mysql://localhost:3306/db_school?useUnicode=true&characterEncoding=utf-8", "root", "");
|
||||||
|
sql = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
|
||||||
|
sql.executeUpdate(condition);
|
||||||
|
con.close();
|
||||||
|
sql.close();
|
||||||
|
out.print("公告发布成功!");
|
||||||
|
response.setHeader("refresh", "2;url=../mainframe.jsp");
|
||||||
|
out.print("2秒后自动返回...");
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (SQLException event) {
|
||||||
|
out.print("发布公告失败");
|
||||||
|
response.setHeader("refresh", "5;url=../mainframe.jsp");
|
||||||
|
out.print("5秒后自动返回...");
|
||||||
|
}
|
||||||
|
%>
|
||||||
|
</BODY>
|
||||||
|
</HTML>
|
||||||
43
WebRoot/notice/delete.jsp
Normal file
43
WebRoot/notice/delete.jsp
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
<%@ page contentType="text/html;charset=UTf-8" %>
|
||||||
|
<%@ page import="java.sql.*" %>
|
||||||
|
<%! //处理字符串的方法:
|
||||||
|
public String codeString(String s)
|
||||||
|
{ String str=s;
|
||||||
|
try{byte b[]=str.getBytes("ISO-8859-1");
|
||||||
|
str=new String(b); return str;
|
||||||
|
} catch(Exception e) { return str; }
|
||||||
|
}
|
||||||
|
%>
|
||||||
|
<HTML>
|
||||||
|
<head>
|
||||||
|
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
|
||||||
|
<meta http-equiv="refresh" content="2;url=index.jsp">
|
||||||
|
<title></title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<BODY>
|
||||||
|
<%
|
||||||
|
String k1=request.getParameter("t1"); if(k1==null){k1="";} k1=codeString(k1);
|
||||||
|
Connection con=null;
|
||||||
|
Statement sql=null;
|
||||||
|
ResultSet rs=null;
|
||||||
|
try{Class.forName("com.mysql.jdbc.Driver");}catch(ClassNotFoundException event){out.print("暂时无法访问");}
|
||||||
|
String condition=null;
|
||||||
|
out.print(k1);
|
||||||
|
condition="DELETE from 公告表1 WHERE 公告编号 = '"+k1+"'";
|
||||||
|
try {
|
||||||
|
con=DriverManager.getConnection("jdbc:mysql://localhost/公告栏","root","123456");
|
||||||
|
sql=con.createStatement();
|
||||||
|
sql.executeUpdate(condition);
|
||||||
|
out.print("成功删除!</a>");
|
||||||
|
response.setHeader("refresh","5;url=index.jsp");
|
||||||
|
out.print("5秒后自动返回...");
|
||||||
|
sql.close();
|
||||||
|
con.close();
|
||||||
|
} catch(SQLException event)
|
||||||
|
{
|
||||||
|
out.print("删除失败");
|
||||||
|
response.setHeader("refresh","5;url=index.jsp");
|
||||||
|
out.print("5秒后自动返回...");}
|
||||||
|
%>
|
||||||
|
</BODY></HTML>
|
||||||
80
WebRoot/notice/index.jsp
Normal file
80
WebRoot/notice/index.jsp
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
<%@ page contentType="text/html;charset=UTF-8"%>
|
||||||
|
<%@ page import="java.sql.*"%>
|
||||||
|
<%!//处理字符串的方法:
|
||||||
|
public String codeString(String s) {
|
||||||
|
String str = s;
|
||||||
|
try {
|
||||||
|
byte b[] = str.getBytes("ISO-8859-1");
|
||||||
|
str = new String(b);
|
||||||
|
return str;
|
||||||
|
} catch (Exception e) {
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
}%>
|
||||||
|
|
||||||
|
<HTML>
|
||||||
|
<style>
|
||||||
|
.zczi {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.zczi2 {
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<div align=center>
|
||||||
|
<b>公告栏</b>
|
||||||
|
</div>
|
||||||
|
<p></p>
|
||||||
|
<center>
|
||||||
|
<table border>
|
||||||
|
<tr>
|
||||||
|
<th bgcolor=#FFFFFF><marquee direction=up height=300 width=500
|
||||||
|
id=m onmouseout=m.start() onMouseOver=m.stop() scrollamount=2
|
||||||
|
align="center">
|
||||||
|
<font size=2>
|
||||||
|
|
||||||
|
<p></p>
|
||||||
|
<p>
|
||||||
|
<%
|
||||||
|
Connection con;
|
||||||
|
Statement sql;
|
||||||
|
ResultSet rs;
|
||||||
|
try {
|
||||||
|
Class.forName("com.mysql.jdbc.Driver");
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
out.print("驱动异常");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
con = DriverManager.getConnection(
|
||||||
|
"jdbc:mysql://localhost:3306/db_school?useUnicode=true&characterEncoding=utf-8", "root", "");
|
||||||
|
sql = con.createStatement();
|
||||||
|
String condition = null;
|
||||||
|
condition = "SELECT 公告内容,公告时间 FROM notice";
|
||||||
|
rs = sql.executeQuery(condition);
|
||||||
|
while (rs.next()) //输出查询结果
|
||||||
|
{
|
||||||
|
out.print("<div><span class='zczi2'>" + rs.getString(1) + "</span>");
|
||||||
|
|
||||||
|
out.print("<span class='zczi'>" + rs.getString(2) + "</span></div>");
|
||||||
|
out.println("<br/>");
|
||||||
|
out.println("<br/>");
|
||||||
|
}
|
||||||
|
con.close();
|
||||||
|
sql.close();
|
||||||
|
rs.close();
|
||||||
|
} catch (SQLException e1) {
|
||||||
|
out.print("无法查询记录");
|
||||||
|
}
|
||||||
|
%>
|
||||||
|
</p >
|
||||||
|
</p>
|
||||||
|
</font>
|
||||||
|
</marquee></th>
|
||||||
|
</table>
|
||||||
|
<center>
|
||||||
|
<a href=add.html>增加公告</a> <a href=selectupdate.jsp>修改公告</a> <a
|
||||||
|
href=selectdelete.jsp>删除公告</a>
|
||||||
|
<BODY>
|
||||||
|
</BODY>
|
||||||
|
</HTML>
|
||||||
56
WebRoot/notice/selectdelete.jsp
Normal file
56
WebRoot/notice/selectdelete.jsp
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
<%@ page contentType="text/html;charset=UTF-8" %>
|
||||||
|
<%@ page import="java.sql.*" %>
|
||||||
|
<%! //处理字符串的方法:
|
||||||
|
public String codeString(String s)
|
||||||
|
{ String str=s;
|
||||||
|
try{byte b[]=str.getBytes("ISO-8859-1");
|
||||||
|
str=new String(b);
|
||||||
|
return str;
|
||||||
|
} catch(Exception e) { return str; }
|
||||||
|
}
|
||||||
|
%>
|
||||||
|
<HTML>
|
||||||
|
<BODY>
|
||||||
|
<%
|
||||||
|
Connection con;
|
||||||
|
Statement sql;
|
||||||
|
ResultSet rs;
|
||||||
|
try{Class.forName("com.mysql.jdbc.Driver");
|
||||||
|
} catch(ClassNotFoundException e){out.print("暂时无法访问");}
|
||||||
|
try {
|
||||||
|
con=DriverManager.getConnection("jdbc:mysql://localhost/公告栏","root","123456");
|
||||||
|
sql=con.createStatement();
|
||||||
|
String condition=null;
|
||||||
|
condition="SELECT * FROM 公告表1";
|
||||||
|
rs=sql.executeQuery(condition);
|
||||||
|
out.print("<Table Border align='center'>");
|
||||||
|
out.print("<TR>");
|
||||||
|
out.print("<TH width=100 >"+"公告编号");
|
||||||
|
|
||||||
|
out.print("<TH width=100 >"+"公告内容");
|
||||||
|
out.print("<TH width=100 >"+"公告作者");
|
||||||
|
out.print("<TH width=100 >"+"公告时间");
|
||||||
|
out.print("</TR>");
|
||||||
|
while(rs.next()) //输出查询结果
|
||||||
|
{ out.print("<TR>");
|
||||||
|
out.print("<TD height=100 vertical-align:top>"+rs.getString(1)+"</TD>");
|
||||||
|
out.print("<TD height=100 vertical-align:top>"+rs.getString(2)+"</TD>");
|
||||||
|
out.print("<TD height=100 vertical-align:top>"+rs.getString(3)+"</TD>");
|
||||||
|
out.print("<TD height=100 vertical-align:top>"+rs.getString(4)+"</TD>");
|
||||||
|
|
||||||
|
out.print("</TR>") ;
|
||||||
|
}
|
||||||
|
out.print("</Table>");
|
||||||
|
|
||||||
|
con.close();
|
||||||
|
}
|
||||||
|
catch(SQLException e1) {out.print("无法查询记录");}
|
||||||
|
%>
|
||||||
|
<form 公告编号="form2" method="post" action="delete.jsp">
|
||||||
|
<div align='center'>
|
||||||
|
请输入你要删除的公告编号<input name="t1" size="11" type="text">
|
||||||
|
<input type="submit" class="btcss2" value="提交删除" /><br />
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</BODY>
|
||||||
|
</HTML>
|
||||||
58
WebRoot/notice/selectupdate.jsp
Normal file
58
WebRoot/notice/selectupdate.jsp
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
<%@ page contentType="text/html;charset=UTF-8" %>
|
||||||
|
<%@ page import="java.sql.*" %>
|
||||||
|
<%! //处理字符串的方法:
|
||||||
|
public String codeString(String s)
|
||||||
|
{ String str=s;
|
||||||
|
try{str=new String(s.getBytes("ISO8859-1"),"UTF-8");
|
||||||
|
return str;
|
||||||
|
} catch(Exception e) { return str; }
|
||||||
|
}
|
||||||
|
%>
|
||||||
|
<HTML>
|
||||||
|
<BODY>
|
||||||
|
<%
|
||||||
|
|
||||||
|
Connection con;
|
||||||
|
Statement sql;
|
||||||
|
ResultSet rs;
|
||||||
|
try{Class.forName("com.mysql.jdbc.Driver");
|
||||||
|
} catch(ClassNotFoundException e){out.print("暂时无法访问");}
|
||||||
|
try {
|
||||||
|
con=DriverManager.getConnection("jdbc:mysql://localhost/公告栏","root","123456");
|
||||||
|
sql=con.createStatement();
|
||||||
|
String condition=null;
|
||||||
|
condition="SELECT * FROM 公告表1";
|
||||||
|
rs=sql.executeQuery(condition);
|
||||||
|
out.print("<Table Border align='center'>");
|
||||||
|
out.print("<TR>");
|
||||||
|
out.print("<TH width=100 >"+"公告编号");
|
||||||
|
// out.print("<TH width=100 >"+"公告题目");
|
||||||
|
out.print("<TH width=100 >"+"公告内容");
|
||||||
|
out.print("<TH width=100 >"+"公告作者");
|
||||||
|
out.print("<TH width=100 >"+"公告时间");
|
||||||
|
out.print("</TR>");
|
||||||
|
while(rs.next()) //输出查询结果
|
||||||
|
{ out.print("<TR>");
|
||||||
|
out.print("<TD height=100 vertical-align:top>"+rs.getString(1)+"</TD>");
|
||||||
|
out.print("<TD height=100 vertical-align:top>"+rs.getString(2)+"</TD>");
|
||||||
|
out.print("<TD height=100 vertical-align:top>"+rs.getString(3)+"</TD>");
|
||||||
|
out.print("<TD height=100 vertical-align:top>"+rs.getString(4)+"</TD>");
|
||||||
|
//out.print("<TD height=100 vertical-align:top>"+rs.getString(5)+"</TD>");
|
||||||
|
out.print("</TR>") ;
|
||||||
|
}
|
||||||
|
out.print("</Table>");
|
||||||
|
|
||||||
|
con.close();
|
||||||
|
}
|
||||||
|
catch(SQLException e1) {out.print("无法查询记录");}
|
||||||
|
%>
|
||||||
|
<form 公告编号="form2" method="post" action="update.jsp">
|
||||||
|
<div align="center">
|
||||||
|
请输入你要修改的公告编号<br /><input name="a1" size="11" type="text"><br/>
|
||||||
|
请输入你要修改的公告内容:<br /><textarea name="a2" cols="40" rows="5" type="text"></textarea>
|
||||||
|
<br /><br />
|
||||||
|
<input type="submit" class="btcss2" value="提交修改" /><br />
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</BODY>
|
||||||
|
</HTML>
|
||||||
37
WebRoot/notice/update.jsp
Normal file
37
WebRoot/notice/update.jsp
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
<%@ page contentType="text/html;charset=UTF-8" %>
|
||||||
|
<%@ page import="java.sql.*" %>
|
||||||
|
|
||||||
|
<HTML>
|
||||||
|
<head>
|
||||||
|
</head>
|
||||||
|
<BODY>
|
||||||
|
<%
|
||||||
|
request.setCharacterEncoding("utf-8");
|
||||||
|
String k1=request.getParameter("a1"); //if(k1==null){k1="";} k1=codeString(k1);
|
||||||
|
String k2=request.getParameter("a2"); //if(k2==null){k2="";} k2=codeString(k2);
|
||||||
|
|
||||||
|
Connection con=null;
|
||||||
|
Statement sql=null;
|
||||||
|
ResultSet rs=null;
|
||||||
|
String condition=null;
|
||||||
|
condition="UPDATE 公告表1 SET 公告内容='"+k2+"' WHERE 公告编号='"+k1+"' ";
|
||||||
|
try{Class.forName("com.mysql.jdbc.Driver");}catch(ClassNotFoundException event){out.print("驱动异常");}
|
||||||
|
try {
|
||||||
|
con=DriverManager.getConnection("jdbc:mysql://localhost/公告栏","root","123456");
|
||||||
|
sql=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
|
||||||
|
|
||||||
|
sql.executeUpdate(condition);
|
||||||
|
con.close();
|
||||||
|
|
||||||
|
out.print("公告修改成功!</a>");
|
||||||
|
response.setHeader("refresh","5;url=index.jsp");
|
||||||
|
out.print("5秒后自动返回...");
|
||||||
|
|
||||||
|
} catch(SQLException event)
|
||||||
|
{
|
||||||
|
out.print("修改公告失败");
|
||||||
|
response.setHeader("refresh","5;url=index.jsp");
|
||||||
|
out.print("5秒后自动返回...");
|
||||||
|
}
|
||||||
|
%>
|
||||||
|
</BODY></HTML>
|
||||||
23
xz1_v1.1.iml
Normal file
23
xz1_v1.1.iml
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="JAVA_MODULE" version="4">
|
||||||
|
<component name="EclipseModuleManager">
|
||||||
|
<conelement value="com.genuitec.runtime.library/com.genuitec.generic_7.0" />
|
||||||
|
<conelement value="org.eclipse.jst.j2ee.internal.web.container" />
|
||||||
|
<conelement value="org.eclipse.jst.j2ee.internal.module.container" />
|
||||||
|
<src_description expected_position="0">
|
||||||
|
<src_folder value="file://$MODULE_DIR$/src" expected_position="0" />
|
||||||
|
</src_description>
|
||||||
|
</component>
|
||||||
|
<component name="NewModuleRootManager">
|
||||||
|
<output url="file://$MODULE_DIR$/WebRoot/WEB-INF/classes" />
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
<orderEntry type="jdk" jdkName="JavaSE-1.7" jdkType="JavaSDK" />
|
||||||
|
<orderEntry type="library" name="com.genuitec.runtime.library/com.genuitec.generic_7.0" level="application" />
|
||||||
|
<orderEntry type="library" name="org.eclipse.jst.j2ee.internal.web.container" level="application" />
|
||||||
|
<orderEntry type="library" name="org.eclipse.jst.j2ee.internal.module.container" level="application" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
Reference in New Issue
Block a user