guestbook.jsp
上传用户:jhtang88
上传日期:2014-01-27
资源大小:28528k
文件大小:5k
源码类别:

Jsp/Servlet

开发平台:

Java

  1. <%@ page contentType="text/html;charset=utf-8"%>
  2. <%@ page import = "java.net.URLEncoder"%>
  3. <%@ page import="cn.js.fan.util.*"%>
  4. <%@ page import="cn.js.fan.db.*"%>
  5. <%@ page import="com.redmoon.oa.pvg.*"%>
  6. <html>
  7. <head>
  8. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  9. <title>留言簿</title>
  10. <link href="../common.css" rel="stylesheet" type="text/css">
  11. <LINK href="default.css" type=text/css rel=stylesheet>
  12. <style type="text/css">
  13. <!--
  14. .style1 {font-size: 16px}
  15. .style2 {
  16. color: #FFFFFF;
  17. font-weight: bold;
  18. }
  19. .style4 {color: #000000}
  20. -->
  21. </style>
  22. </head>
  23. <body leftmargin="0" topmargin="5">
  24. <jsp:useBean id="msgmgr" scope="page" class="cn.js.fan.module.guestbook.MessageMgr"/>
  25. <jsp:useBean id="privilege" scope="page" class="com.redmoon.oa.pvg.Privilege"/>
  26. <%
  27. if (!privilege.isUserPrivValid(request, PrivDb.PRIV_ADMIN))
  28. {
  29. out.println(StrUtil.makeErrMsg(privilege.MSG_INVALID,"red","green"));
  30. return;
  31. }
  32. %>
  33. <table width='100%' cellpadding='0' cellspacing='0' >
  34.   <tr>
  35.     <td class="head">留言簿管理</td>
  36.   </tr>
  37. </table>
  38. <br>
  39. <TABLE class="frame_gray"  
  40. cellSpacing=0 cellPadding=0 width="95%" align=center>
  41.   <TBODY>
  42.     <TR>
  43.       <TD height=200 valign="top" bgcolor="#FFFBFF"><table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
  44.         <tr>
  45.           <td width="100%" height="94%" valign="top"><table width="90%" border="0">
  46.               <tr>
  47.                 <td height="5"></td>
  48.               </tr>
  49.             </table>
  50.               <%
  51. String strcurpage = StrUtil.getNullString(request.getParameter("CPages"));
  52. if (strcurpage.equals(""))
  53. strcurpage = "1";
  54. if (!StrUtil.isNumeric(strcurpage)) {
  55. out.print(StrUtil.makeErrMsg("标识非法!"));
  56. return;
  57. }
  58. int pagesize = 20;
  59. int curpage = Integer.parseInt(strcurpage);
  60. String sql = "select id,username,content,lydate,reply,redate from guestbook order by lydate desc";
  61. ResultIterator ri = msgmgr.list(sql, curpage, pagesize );
  62. ResultRecord rr = null;
  63. Paginator paginator = new Paginator(request, ri.getTotal(), pagesize);
  64. %>
  65.               <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
  66.                 <tr>
  67.                   <td width="47">&nbsp;</td>
  68.                   <td valign="top"><div align="center" class="title1">找到符合条件的记录 <b><%=paginator.getTotal() %></b> 条 每页显示 <b><%=paginator.getPageSize() %></b> 条 页次 <b><%=paginator.getCurrentPage() %>/<%=paginator.getTotalPages() %></b></div></td>
  69.                   <td width="47">&nbsp;</td>
  70.                 </tr>
  71.               </table>
  72.               <%
  73. while (ri.hasNext()) {
  74.   rr = (ResultRecord)ri.next(); %>
  75.               <table width="98%" border="0" align="center" cellpadding="2" cellspacing="0" bgcolor="#E7E7E7" class="tableframe">
  76.                 <tr>
  77.                   <td width="24%" height="22" valign="bottom" class="stable style4">用户:<%=StrUtil.toHtml((String)rr.get("username"))%> </td>
  78.                   <td width="43%" height="22" valign="bottom" class="stable style4">留言日期:<%=rr.get("lydate").toString().substring(0,16)%></td>
  79.                   <td width="16%" valign="bottom" class="stable style4"><span class="stable"><a href="guestbook_mod.jsp?id=<%=rr.get("id")%>">修改/回复</a></span></td>
  80.                   <td width="17%" valign="bottom" class="stable style4"><span class="stable"><a href="guestbook_del.jsp?id=<%=rr.get("id")%>">删除</a></span></td>
  81.                 </tr>
  82.                 <tr valign="top">
  83.                   <td height="83" colspan="4" class="stable"><%=StrUtil.toHtml((String)rr.get("content"))%><br>
  84.                       <%
  85.   String reply = StrUtil.getNullString((String)rr.get("reply"));
  86.   if (!reply.equals(""))
  87.   {
  88.   %>
  89.                       <font color="#F09F6F"><br>
  90.             回复:</font><%=StrUtil.toHtml((String)rr.get("reply"))%> <br>
  91.             回复日期:<%=((java.util.Date)rr.get("redate")).toString().substring(0,16)%>
  92.             <% } %>
  93.                   </td>
  94.                 </tr>
  95.               </table>
  96.               <br>
  97.               <%}
  98. %>
  99.               <br>
  100.               <table width="87%" border="0" cellspacing="1" cellpadding="3" align="center" class="9black">
  101.                 <tr>
  102.                   <td height="23"><div align="right">
  103.                       <%
  104. String querystr = "";
  105.     out.print(paginator.getCurPageBlock("guestbook.jsp?"+querystr));
  106. %>
  107.                   </div></td>
  108.                 </tr>
  109.               </table>
  110.               <br>
  111.           </td>
  112.         </tr>
  113.         <tr>
  114.           <td height="6%">&nbsp;</td>
  115.         </tr>
  116.       </table></TD>
  117.     </TR>
  118.   </TBODY>
  119. </TABLE>
  120. </body>
  121. <SCRIPT language=javascript id=clientEventHandlersJS>
  122. <!--
  123. function form1_onsubmit()
  124. {
  125. if (form1.content.value=="")
  126. {
  127. alert("留言内容不能为空!");
  128. return false;
  129. }
  130. }
  131. //-->
  132. </SCRIPT>
  133. </html>