81,094
社区成员
发帖
与我相关
我的任务
分享
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page import="java.util.*" isELIgnored="false" %>
<%@page import="java.util.List"%>
<%@page import="java.util.ArrayList"%>
<%@page import="tkl.download.dao.HibernateDAO"%>
<%@page import="tkl.download.dao.MessageBean"%><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>留言列表</title>
<style type="text/css">
<!--
.zong {
float: left;
width: 580px;
}
body {
margin: 0px;
padding: 0px;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
}
form {
margin: 0px;
padding: 0px;
}
.lylb {
float: left;
width: 600px;
}
.lylb1 {
float: left;
width: 600px;
border: 1px solid #CCCCCC;
padding-top: 5px;
padding-bottom: 5px;
}
.lylb2 {
float: left;
width: 600px;
border: 1px solid #CCCCCC;
padding-top: 10px;
padding-bottom: 10px;
}
.lbnum1 {
float: left;
width: 115px;
text-align: center;
}
.lbnum2 {
float: left;
width: 393px;
}
.lbnum3 {
float: left;
width: 90px;
text-align: center;
}
.li {
float: left;
line-height: 24px;
width: 598px;
}
.lylb3 {
float: left;
width: 600px;
padding-top: 22px;
padding-bottom: 22px;
text-align: center;
}
.a333 {
COLOR: #333333
}
.a333 A:link {
COLOR: #333333;
TEXT-DECORATION: none
}
.a333 A:visited {
COLOR: #333333;
TEXT-DECORATION: none
}
.a333 A:hover {
COLOR: #f16c03;
TEXT-DECORATION: none
}
.a333 A:active {
COLOR: #f16c03;
TEXT-DECORATION: none
}
.red {
COLOR: #ff3300
}
.red A:link {
COLOR: #ff3300;
TEXT-DECORATION: none
}
.red A:visited {
COLOR: #ff3300;
TEXT-DECORATION: none
}
.red A:hover {
LEFT: 1px;
COLOR: #ce1211;
POSITION: relative;
TOP: 1px;
TEXT-DECORATION: none
}
.red A:active {
LEFT: 1px;
COLOR: #ce1211;
POSITION: relative;
TOP: 1px;
TEXT-DECORATION: none
}
-->
</style>
</head>
<body>
${pageIndex}
<div class="lylb">
<div class="lylb1">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20%" align="center">时间</td>
<td width="34%" align="center">留言主题</td>
<td width="32%" align="center"> </td>
<td width="14%" align="center">留言人</td>
</tr>
</table>
</div>
<%
//<c:set var="maxRows" value="2" />
//<c:set var="pageCount" value="${totalSize % maxRows==0?(totalSize/maxRows+1):(totalSize/maxRows)}"/>
int totalSize = HibernateDAO.getInstance().getReplayedMessgeCount();
int maxRows = 10;
int pageCount = 0;
if(totalSize % maxRows==0)
{
pageCount =totalSize/maxRows ;
}
else
{
pageCount = totalSize/maxRows + 1;
}
//define max rows per page
pageContext.setAttribute("totalSize",totalSize);
pageContext.setAttribute("maxRows",maxRows);
pageContext.setAttribute("pageCount",pageCount);
%>
<c:if test="${totalSize>0}">
<c:set var="pageIndex" value="${empty param.pageIndex? 0 : param.pageIndex}"/>
<%
Object obj = pageContext.getAttribute("pageIndex");
List<MessageBean> queryresults = null;
try
{
int pageIndex = Integer.valueOf(obj.toString());
int startrow = pageIndex * maxRows;
queryresults = HibernateDAO.getInstance().retievePagedReplayedMessge(startrow,maxRows);
}catch(Exception ex)
{
queryresults = null;
}
pageContext.setAttribute("queryresults",queryresults);
%>
<c:choose>
<c:when test="${empty queryresults}">
<c:out value="选择的页面号码不对!"></c:out>
</c:when>
<c:otherwise>
<div class="lylb2 a333">
<c:set value="1" var="i"/>
<c:forEach items="${queryresults}" var="info">
<c:choose>
<c:when test="${i%2==0}" >
<div class="li" style="background: #FFFFFF">
<div class="lbnum1" style="background: #FFFFFF">${fn:substring(info.leaveTime,0,10)}</div>
<div class="lbnum2 red" style="background: #FFFFFF"><a href="messagesee.jsp?msgId=${info.msgId}"/>${fn:substring(info.leaveTitle,0,29)}</a>
</div>
<div class="lbnum3" style="background: #FFFFFF">${info.leaveName==null||info.leaveName==''?'游客':info.leaveName}</div>
</div>
</c:when>
<c:otherwise>
<div class="li" style="background: #EFEFF8">
<div class="lbnum1" style="background: #EFEFF8">${fn:substring(info.leaveTime,0,10)}</div>
<div class="lbnum2 red" style="background: #EFEFF8"><a href="messagesee.jsp?msgId=${info.msgId}"/>${fn:substring(info.leaveTitle,0,29)}</a>
</div>
<div class="lbnum3" style="background: #EFEFF8">${info.leaveName==null||info.leaveName==''?'游客':info.leaveName}</div>
</div>
</c:otherwise>
</c:choose>
<c:set value="${i + 1}" var="i"/>
</c:forEach>
</div>
<div class="lylb3">
<table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td width="74%" align="middle">
<c:if test="${pageIndex>0}">
<a class = "red" href="?pageIndex=0">首页</a>
<a class = "red" href="?pageIndex=${param.pageIndex-1}">上一页</a>
</c:if>
<c:if test="${pageCount>1}">
<c:forEach begin="0" end="${pageCount-1}" step="1" var="pageNum">
<c:if test="${pageIndex!=pageNum}">
<a class = "red" href="?pageIndex=${pageNum}">[${pageNum+1}]</a>
</c:if>
<c:if test="${pageIndex==pageNum}">
<strong>${pageNum+1}</strong>
</c:if>
</c:forEach>
</c:if>
<c:if test="${pageIndex<pageCount-1}">
<a class = "red" href="?pageIndex=${param.pageIndex+1}">下一页</a>
<a class = "red" href="?pageIndex=${pageCount-1}">末页</a>
</c:if>
</tr>
</table>
</div>
</c:otherwise>
</c:choose>
</c:if></div>
</body>
</html>