`

details

 
阅读更多
<%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
<%@ page import="bysj.Dao.*"%>
<%@ page import="bysj.Entity.*"%>
<%!int newid=0; %>
<%!int index=0; %>
<%
request.setCharacterEncoding("gbk");
NewsDao newsdao = new NewsDao();
//int index=0;
int prep=0;
int next=0;
if(request.getParameter("newsID")!=null){
newid=Integer.parseInt(request.getParameter("newsID"));
}else{
prep=index;
next=index;
if(request.getParameter("index")!=null){
boolean isnull=false;
for(int i=0;i<NewsDao.newslist.size();i++)
{
if(newid==(Integer)NewsDao.newslist.get(i)){
index=i+1;
isnull=true;
newid=0;
//out.print("<script>alert('"+newid+isnull+index+"')</script>");
}
//out.print("<script>alert('"+newid+"  "+i+"')</script>");
}
//out.print("<script>alert('"+newid+isnull+index+"')</script>");
if(isnull==false){
index=Integer.parseInt(request.getParameter("index"));
}
}
if(index>=1){
prep=index-1;
}
if(index<=NewsDao.newslist.size()-1){
next=index+1;
}
if(index==0){
index=NewsDao.newslist.size()-1;
}
if(index==NewsDao.newslist.size()){
index=0;
}
newid=(Integer)NewsDao.newslist.get(index);
}
News news=(News)newsdao.findNewsByID(newid);
//int newsID = news.getNewsID();
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<title>新闻信息页面</title>
<style>
.font{font-size=14px;
      font-weight:bold}
      .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>><a href="showNewsList.jsp">站内新闻</a>
</td>
</tr>
<tr>
<td>
<%@ include file="left.jsp"%>
</td>
<td valign="top">
<table border="0" width="589">
<tr style="background-image:url('image/cg2.jpg'); " height="50">
<td colspan="2" align="center" class="font">
<%=news.getTitle()%> </td>
</tr>
<tr>
<td width="500" rowspan="2">
<%=news.getContent()%> </td>
    <td>&nbsp;</td>
</tr>
<tr>
<td>
<img src="image/n10.jpg"></img> </td>
</tr>
<tr>
<td align="right">
<a href="detailNews.jsp?index=<%=prep %>">上一条</a>|<a href="detailNews.jsp?index=<%=next %>">下一条</a> </td>
<td align="center">
<%=news.getWriterDate()%> </td>
</tr>
</table>
</td>
</tr>
</table>
</body>
<%@ include file="bottom.jsp"%>
</html>
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics