📄 bginforlist.jsp
字号:
<%@ page language="java" import="java.util.*,com.project.util.DateTimeUtil" pageEncoding="UTF-8"%>
<%@ page import="com.project.util.StringUtil" %>
<%@page import="com.model.entity.NewsInfo"%>
<%@page import="com.model.dao.DBAccessNews" %>
<%
//每次显示多少
int pageSize = 10;
int pageNum = 0;
int sumNum = 0;
int totalPage = 0;
int falg = 0;
int num = 0;
List newsList = new ArrayList();
Integer temp = 0;
Integer IpageNum = 0;
if(session.getAttribute("userInfo") == null){
response.sendRedirect(request.getContextPath() + "/login.jsp");
}else{
Map newsMap = (Map)request.getAttribute("backNews");//l
newsList = (List)newsMap.get("newsInfo");//计算setFirstResout&&setMaxResout
temp = (Integer)newsMap.get("newsNum");//共多少条记录
IpageNum = (Integer)newsMap.get("pageNum");//初始的传进的地条记录的位置
//当前页号
pageNum = IpageNum.intValue();
//共多少条
sumNum = temp.intValue();
//共多少页
totalPage = 0;
falg = 0;
if(sumNum < pageSize ){
totalPage = 1;
}else{
if(sumNum % pageSize == 0){
totalPage = sumNum / pageSize;
}else{
falg = 1;
totalPage = sumNum / pageSize + 1;
}
}
for(int i=0;i < totalPage;i++){
if(pageNum == i){
num = i;
}
}
}
%>
<html>
<head>
<script language=JavaScript>
function DoEmpty(params)
{
if (confirm("真的要删除吗?"))
window.location = "<%=request.getContextPath()%>/delinfors.do?newsId=" + params ;
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
td img {display: block;}body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
background-image: url(jsp/images/bei.gif);
</style>
<!--Fireworks 8 Dreamweaver 8 target. Created Wed Sep 05 13:51:49 GMT+0800 2007-->
<link href="<%=request.getContextPath()%>/jsp/css/css.css"
rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
a:link {
color: #666666;
text-decoration: none;
}
a:visited {
color: #666699;
text-decoration: none;
}
a:hover {
color: #003399;
text-decoration: none;
}
a:active {
color: #FF0000;
text-decoration: none;
}
-->
</style>
<script type="text/JavaScript">
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
function nextPage(pageNum,pageSize){
document.nextPageForm.pageNum.value = pageNum;
document.nextPageForm.pageSize.value = pageSize;
document.nextPageForm.submit();
}
</script>
</head>
<body>
<table width="500 border="0" align="center" cellpadding="0" cellspacing="0" >
<tr>
<jsp:include flush="true" page="../include/backTop.jsp" />
<tr>
<tr>
<td height="1000" colspan="2" align="center" valign="top" bgcolor="#FFFFFF">
<table height="400" width="780" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr valign="top">
<td height="9" align="right" valign="top">
<table width="300" border="0" valign="top">
<form name="nextPageForm" action="<%=request.getContextPath() %>/inforlist.do" method="post">
<input name="pageNum" type="hidden" value="" />
<input name="pageSize" type="hidden" value="" />
<tr class="nei20">
<a href="javaScript:nextPage('0','<%=pageSize %>');">首页</a>
<%if(pageNum >= 1){%>
<a href="javaScript:nextPage('<%=pageNum-1%>','<%=pageSize%>');">上一页</a>
<%}else{%>
上一页
<%} %>
<%if(pageNum < totalPage-1){ %>
<a href="javaScript:nextPage('<%=pageNum+1%>','<%=pageSize%>');">下一页</a>
<a href="javaScript:nextPage('<%=totalPage-1%>','<%=pageSize%>');">尾页</a>
<%}else{ %>
下一页
尾页
<%} %>
共<%=sumNum %> 条记录
第<%=pageNum+1 %>页
共<%=totalPage %>页 </tr>
</form>
</table>
</td>
</tr>
<tr>
<td valign="top">
<table width="750" border="1" align="center" cellpadding="5" cellspacing="0" bordercolor="#FFFFFF" bordercolorlight="000000" valign="top">
<caption>
</caption>
<tr> </tr>
<tr>
<td width="3%" bgcolor="#EAEAEA" class="css" align="center">序号</td>
<th width="20%" bgcolor="#EAEAEA" class="css">标题</th>
<th width="10%" bgcolor="#EAEAEA" class="css">创建时间</th>
<th width="5%" bgcolor="#EAEAEA" class="css">删除</th>
<th width="5%" bgcolor="#EAEAEA" class="css">修改</th>
</tr>
<%
for (int i = 0; i < newsList.size(); i++) {
NewsInfo newsInfo = (NewsInfo) newsList.get(i);
%>
<tr>
<%if(i<9){ %>
<td class="nei20" align="center"><%=(num == 0)?i+1:String.valueOf(num)+String.valueOf(i+1) %></td>
<%}else{ %>
<td class="nei20" align="center"><%=String.valueOf(num+1)+"0" %></td>
<% }%>
<td class="nei20" align="center"><a href="<%=request.getContextPath() %>/look.do?newsId=<%=newsInfo.getNewsId() %>" target="_blank"><%=newsInfo.getTitle()%></a></td>
<td class="nei20" align="center"><%=newsInfo.getCreateDate().substring(0,10)%></td>
<td class="nei20" align="center"><a href="javascript:DoEmpty('<%=newsInfo.getNewsId()%>');">删除</a></td>
<td class="nei20" align="center"><a href="<%=request.getContextPath()%>/upinforfornews.do?newsId=<%=newsInfo.getNewsId()%>">修改</a></td>
</tr>
<%
}
%>
</table>
<div align="left"> <input class="unnamed5" type="button" value=" 添 加 " onclick="location.href='<%=request.getContextPath()%>/jsp/back/BgInformation.jsp'"/></div>
</td>
</tr>
<tr valign="top">
<td>
</td>
</tr>
<tr>
<jsp:include flush="true" page="../include/foot.jsp" />
</tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -