<%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
<%@ page import="bysj.Dao.*"%>
<%@ page import="bysj.Entity.*"%>
<%
request.setCharacterEncoding("GBK");
NewsDao newss=new NewsDao();
%>
<%!int index=0; %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title</title>
<style>
.border{background-color:#FFF5FA}
</style>
<link rel="stylesheet" type="text/css" href="css/right.css">
</head>
<body>
<%@ include file="top.jsp"%>
<table border="0" align="center" width="799" class="border">
<tr>
<td colspan="2">
<a href="index.jsp">首页</a>>站内新闻
</td>
</tr>
<tr>
<td class="Right" valign="top">
<%@ include file="left.jsp"%>
</td>
<td>
<table border="0" width="589">
<tr>
<td colspan="2">
新闻列表
</td>
</tr>
<%
int p = 1;
NewsDao dao = new NewsDao();
if (request.getParameter("page") != null) {
p = Integer.parseInt(request.getParameter("page"));
}
List alllist=dao.findAll();
List list = dao.findAllNews(p);
int a = p;//上一页
int b = p;//下一页
if (list.size() == 7) {
b = p + 1;
}
if (p > 1) {
a = p - 1;
}
for (int i = 0; i < list.size(); i++) {
News news = (News) list.get(i);
//index=list.get(i).hashCode();
//NewsDao.list.add(news);
//newss.list.add(news);
//NewsDao.maplist.put(i,NewsDao.list.add(news));
//NewsDao.newslist.put(index,news.getNewsID());
%>
<tr>
<td width="40">
<%=news.getNewsID()%>
</td>
<td>
<a href="detailNews.jsp?newsID=<%=news.getNewsID()%>"> <%=news.getTitle()%>
</a>
<font color="red">[<%=news.getWriterDate()%>]</font>
</td>
</tr>
<%
index++;
if(index==alllist.size()){
index=0;
}
}
%>
</table>
<p align="right">
<a href="showNewsList.jsp?page=<%=a %>">上一页</a>|
<a href="showNewsList.jsp?page=<%=b %>">下一页</a>
</p>
</td>
</tr>
</table>
</body>
<%@ include file="bottom.jsp"%>
</html>
<%@ page import="bysj.Dao.*"%>
<%@ page import="bysj.Entity.*"%>
<%
request.setCharacterEncoding("GBK");
NewsDao newss=new NewsDao();
%>
<%!int index=0; %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title</title>
<style>
.border{background-color:#FFF5FA}
</style>
<link rel="stylesheet" type="text/css" href="css/right.css">
</head>
<body>
<%@ include file="top.jsp"%>
<table border="0" align="center" width="799" class="border">
<tr>
<td colspan="2">
<a href="index.jsp">首页</a>>站内新闻
</td>
</tr>
<tr>
<td class="Right" valign="top">
<%@ include file="left.jsp"%>
</td>
<td>
<table border="0" width="589">
<tr>
<td colspan="2">
新闻列表
</td>
</tr>
<%
int p = 1;
NewsDao dao = new NewsDao();
if (request.getParameter("page") != null) {
p = Integer.parseInt(request.getParameter("page"));
}
List alllist=dao.findAll();
List list = dao.findAllNews(p);
int a = p;//上一页
int b = p;//下一页
if (list.size() == 7) {
b = p + 1;
}
if (p > 1) {
a = p - 1;
}
for (int i = 0; i < list.size(); i++) {
News news = (News) list.get(i);
//index=list.get(i).hashCode();
//NewsDao.list.add(news);
//newss.list.add(news);
//NewsDao.maplist.put(i,NewsDao.list.add(news));
//NewsDao.newslist.put(index,news.getNewsID());
%>
<tr>
<td width="40">
<%=news.getNewsID()%>
</td>
<td>
<a href="detailNews.jsp?newsID=<%=news.getNewsID()%>"> <%=news.getTitle()%>
</a>
<font color="red">[<%=news.getWriterDate()%>]</font>
</td>
</tr>
<%
index++;
if(index==alllist.size()){
index=0;
}
}
%>
</table>
<p align="right">
<a href="showNewsList.jsp?page=<%=a %>">上一页</a>|
<a href="showNewsList.jsp?page=<%=b %>">下一页</a>
</p>
</td>
</tr>
</table>
</body>
<%@ include file="bottom.jsp"%>
</html>