newslist.jsp
上传用户:junmaots
上传日期:2022-07-09
资源大小:2450k
文件大小:2k
- <%@page contentType="text/html; charset=gbk" language="java" %>
- <%@page import="com.mycompany.news.service.*"%>
- <%@page import="com.mycompany.news.dto.*"%>
- <%@page import="java.util.List"%>
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
- <html>
- <head>
- <link href="./css/common.css" rel="stylesheet" type="text/css">
- <meta http-equiv="Content-Type" content="text/html; charset=gbk">
- <title>栏目新闻列表</title>
- </head>
-
- <%
- String columnid = request.getParameter("columnid");
- ColumnService cs = new ColumnService();
- Column column = cs.getByID(Long.parseLong(columnid));
- int pageNo= 1;
- try{
- pageNo=Integer.parseInt(request.getParameter("pageNo"));
- }catch(Exception e){
- }
- int pageSize = 50;
- NewsService service = new NewsService();
- int totalCount = service.getNewsCountByColumn(Long.valueOf(columnid));
- List results = service.listNewsByColumn(Long.valueOf(columnid),pageNo,pageSize);
- int totalPage = totalCount/pageSize+(totalCount%pageSize==0?1:0);
- %>
- <body leftmargin="40">
- <table width="90%" border=0 align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC" >
- <tr bgcolor="#FFFFFF">
- <th colspan='3'>《<%=column.getColumnName()%>》栏目新闻列表</th>
- </tr>
- <tr bgcolor="#FFFFFF">
- <th width="26%" height="23">新闻时间</th>
- <th width="54%" height="23">新闻标题</th>
- <th width="20%" height="23">新闻作者</th>
- </tr>
- <%for(int i=0;i<results.size();i++){
- News news =(News)results.get(i);
- %>
- <tr bgcolor="#FFFFFF">
- <td height="23"><%=news.getShowTime()%></td>
- <td height="23"><%=news.getSubject()%></td>
- <td height="23"><%=news.getAuthor()%></td>
- </tr>
- <%}%>
- </table>
-
- <table align="center">
- <tr>
- <td colspan="3" align="right">
- <%if(pageNo>1){%>
- <a href="newslist.jsp?columnid=<%=columnid%>&pageNo=1">第一页</a>
- <a href="newslist.jsp?columnid=<%=columnid%>&pageNo=<%=pageNo-1%>">上一页</a>
- <%}%>
- <%if(pageNo<totalPage){%>
- <a href="newslist.jsp?columnid=<%=columnid%>&pageNo=<%=pageNo+1%>">下一页</a>
- <a href="newslist.jsp?columnid=<%=columnid%>&pageNo=<%=pageNo+1%>">最后页</a>
- <%}%>
- </td>
- </tr>
- </table>
- </body>
- </html>