- <%@page contentType="text/html; charset=gb2312" language="java" %>
- <%@page import="com.mycompany.news.service.NewsService"%>
- <%@page import="com.mycompany.news.dao.impl.*"%>
- <%@page import="com.mycompany.news.dto.*"%>
- <%@page import="java.text.SimpleDateFormat"%>
- <!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=gb2312">
- <title>新闻信息</title>
- </head>
- <%
- String pageNo=request.getParameter("pageNo");
- int commentPageNo=1;
- try{
- commentPageNo =Integer.parseInt(pageNo);
- }catch(Exception e){
- }
- Long id=Long.valueOf(request.getParameter("id"));
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
- NewsService service = new NewsService();
- com.mycompany.news.service.NewsCommentService commentService = new com.mycompany.news.service.NewsCommentService();
- service.setNewsDAO(new NewsDAOImpl());
- News news = service.getByID(id.longValue());
- java.util.List attachments = service.getAttachments(id.longValue());
- java.util.List pubComments = commentService.listPublicComment(news,commentPageNo,200);
- %>
- <body leftmargin="40" bgcolor="#FAFAFA">
- <table align="center" border=0 width="90%" height="80%" cellpadding=0 cellspacing=20 bgcolor=#EFEFEF>
- <TR>
- <TD bgColor=#000000 height=1></TD>
- </TR>
- <tr height="10%">
- <td width="90%">
- <table width="100%" height="20%" background="./images/left1.gif">
- <tr>
- <td align="center">
- <font size='4'>
- <b><%=news.getSubject()%>(访问次数 <%=service .getVisitCount(id.longValue())%>)</b>
- </font>
- </td>
- </tr>
- <tr>
- <td align="right" >
- <font size='3'>
- <b>作者(<%=news.getAuthor()%>)-- <%=sdf.format(news.getShowTime())%></b>
- </font>
- </td>
- </tr>
- </table>
- </tr>
- <TR>
- <TD bgColor=#000000 height=1 width="60%"></TD>
- </TR>
- <tr>
- <td colspan='4' align="left" bgColor="#CCCCCC">
- <%=news.getContent()%>
- </td>
- </tr>
- <%for(int i=0;i<attachments.size();i++){
- NewsAttachment attachment = (NewsAttachment )attachments.get(i);
- if(service.isImage(attachment)){
- %>
- <tr>
- <td align="right"><%=attachment.getAttachmentName()%>
- <a href="<%=request.getContextPath()%>/servlet/download?id=<%=attachment.getAttachmentId()%>">
- <image border="0" width="200" height="100" src="<%=request.getContextPath()%>/servlet/download?id=<%=attachment.getAttachmentId()%>">
- </a>
- </td>
- </tr>
- <%
- }
- %>
- <%}%>
- <%for(int i=0;i<attachments.size();i++){
- NewsAttachment attachment = (NewsAttachment )attachments.get(i);
- if(!service.isImage(attachment)){
- %>
- <tr>
- <td align="right"><a href="<%=request.getContextPath()%>/servlet/download?id=<%=attachment.getAttachmentId()%>">附件:<%=attachment.getAttachmentName()%></a></td>
- </tr>
- <%
- }
- %>
- <%}%>
- </table>
- <form action="<%=request.getContextPath()%>/servlet/addcomment">
- <input type="hidden" name="newsId" value="<%=news.getNewsId() %>">
- <table width="100%" height="10%">
- <tr>
- <td align="center"><b>评论</b></td>
- </tr>
- <tr>
- <td align="center">
- 标题:<input type="text" name="commentSubject" size="120" value="评[<%=news.getSubject() %>]">
- 评论人:<input type="text" name="commentPerson" size="10">
- </td>
- </tr>
- <tr>
- <td align="center"><textarea name="commentContent" cols="150" rows="5"></textarea> </td>
- </tr>
- <tr>
- <td align="right">
- <input type="submit" name="b" value="添加">
- <input type="reset" name="r" value="重置">
- </td>
- </tr>
- </table>
- </form>
- <table>
- <%for(int i=0;i<pubComments.size();i++){
- NewsComment comment = (NewsComment )pubComments.get(i);
- %>
- <tr>
- <td width="80%" align="left"><%=comment.getCommentSubject() %></td>
- <td width="20%" align="right"><%=comment.getCommentPerson() %></td>
- </tr>
- <tr>
- <td>
- <textarea cols="150" rows="5" readonly>
- <%=comment.getCommentContent() %>
- </textarea>
- </td>
- </tr>
- <%} %>
- </table>
- </body>
- </html>