.
This commit is contained in:
135
WebRoot/index.jsp
Normal file
135
WebRoot/index.jsp
Normal file
@@ -0,0 +1,135 @@
|
||||
<%@ 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="java.util.Date,java.text.SimpleDateFormat"%>
|
||||
<%
|
||||
String path = request.getContextPath();
|
||||
String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
|
||||
+ path + "/";
|
||||
%>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>帖子列表</title>
|
||||
<link href="css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="font-awesome/css/font-awesome.css" rel="stylesheet">
|
||||
<link href="forum/css/plugins/iCheck/custom.css" rel="stylesheet">
|
||||
<link href="forum/css/animate.css" rel="stylesheet">
|
||||
<link href="forum/css/style.css" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<%
|
||||
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">
|
||||
<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="row">
|
||||
<div class="col-md-8">
|
||||
<h2>帖子列表</h2>
|
||||
</div>
|
||||
<div class="col-md-2 pull-right">
|
||||
<a class="btn btn-default pull-right createNew" href="send.jsp"
|
||||
role="button">发表帖子</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="mail-tools">
|
||||
<div class="btn-group pull-right"></div>
|
||||
|
||||
<%
|
||||
Connection con;
|
||||
Statement sql;
|
||||
ResultSet rs;
|
||||
int id = 0;
|
||||
String subject = "", content = "";
|
||||
Date time = new Date();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat();
|
||||
sdf.format(time);
|
||||
try {
|
||||
Class.forName("com.mysql.jdbc.Driver");
|
||||
} catch (ClassNotFoundException e) {
|
||||
out.print("驱动异常");
|
||||
}
|
||||
con = DriverManager.getConnection("jdbc:mysql://localhost/db_bbs?useUnicode=true&characterEncoding=utf-8",
|
||||
"root", "");
|
||||
sql = con.createStatement();
|
||||
String send = null;
|
||||
content = "select id,subject,time from send";
|
||||
rs = sql.executeQuery(content);
|
||||
while (rs.next()) {
|
||||
id = rs.getInt("id");
|
||||
subject = rs.getString("subject");
|
||||
%>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<table class="table table-hover">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox"></td>
|
||||
<td><a href="detail.jsp?id=<%=id%>"><%=subject%></a></td>
|
||||
<td class="text-right mail-date"><%=rs.getDate("time")%> <%=rs.getTime("time")%></td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<%
|
||||
}
|
||||
sql.close();
|
||||
rs.close();
|
||||
con.close();
|
||||
%>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<%@ include file="module/footer.jsp"%>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Mainly scripts -->
|
||||
<script src="js/jquery-2.1.1.js"></script>
|
||||
<script src="js/bootstrap.min.js"></script>
|
||||
<script src="js/plugins/metisMenu/jquery.metisMenu.js"></script>
|
||||
<script src="js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
|
||||
|
||||
<!-- Custom and plugin javascript -->
|
||||
<script src="js/inspinia.js"></script>
|
||||
<script src="js/plugins/pace/pace.min.js"></script>
|
||||
|
||||
<!-- iCheck -->
|
||||
<script src="js/plugins/iCheck/icheck.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('.i-checks').iCheck({
|
||||
checkboxClass : 'icheckbox_square-green',
|
||||
radioClass : 'iradio_square-green',
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user