<%@page import="java.text.SimpleDateFormat"%> <%@page import="bdqn.newsManageServlet.entity.newsTb"%> <%@page import="bdqn.newsManageServlet.Dao.Impl.newsTbDaoImpl"%> <%@page import="bdqn.newsManageServlet.Dao.newsTbDao"%> <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=GBK" /> <title>新闻中国</title> <link href="../CSS/read.css" rel="stylesheet" type="text/css" /> <script type="text/javascript"> function check(){ var cauthor = document.getElementById("cauthor"); var content = document.getElementById("ccontent"); if(cauthor.value == ""){ alert("用户名不能为空!!"); return false; }else if(content.value == ""){ alert("评论内容不能为空!!"); return false; } return true; } </script> </head> <% int newsid=Integer.parseInt(request.getParameter("newsid")); newsTbDao ndao=new newsTbDaoImpl(); newsTb news=ndao.getAllNewsById(newsid); %> <body> <div id="container"> <div class="main"> <div class="class_type"> <img src="../Images/class_type.gif" alt="新闻中心" /> </div> <div class="content"> <ul class="classlist"> <table width="80%" align="center"> <tr width="100%"> <td colspan="2" align="center"><%=news.getTitle() %></td> </tr> <tr> <td colspan="2"><hr /> </td> </tr> <tr> <td align="center"> <%SimpleDateFormat format=new SimpleDateFormat("yyyy年MM月dd hh:mm:ss"); String dateStr=format.format(news.getCreateDate()); %> <%=dateStr%></td> <td align="left"><%=news.getAuthor() %> </td> </tr> <tr> <td colspan="2" align="center"></td> </tr> <tr> <td colspan="2"><%=news.getContent()%> </td> </tr> <tr> <td colspan="2"><hr /> </td> </tr> </table> </ul> <ul class="classlist"> <table width="80%" align="center"> <td colspan="6"> 暂无评论! </td> <tr> <td colspan="6"><hr /> </td> </tr> </table> </ul> <ul class="classlist"> <form action="#" method="post" οnsubmit="return check()"> <table width="80%" align="center"> <tr> <td> 评 论 </td> </tr> <tr> <td> 用户名: </td> <td><input id="cauthor" name="cauthor" value="这家伙很懒什么也没留下"/> IP: <input name="cip" value="127.0.0.1" readonly="readonly"/> </td> </tr> <tr> <td colspan="2"><textarea name="ccontent" cols="70" rows="10"></textarea> </td> </tr> <td><input name="submit" value="发 表" type="submit"/> </td> </table> </form> </ul> </div> </div> </div> </body> </html>