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="java.util.*"%>
  4. <%@ page import="cn.js.fan.util.*"%>
  5. <%@ page import="cn.js.fan.db.*"%>
  6. <%@ page import="cn.js.fan.web.*"%>
  7. <%@ page import="cn.js.fan.module.guestbook.*"%>
  8. <html>
  9. <head>
  10. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  11. <title>留言簿</title>
  12. <link href="default.css" rel="stylesheet" type="text/css">
  13. <style type="text/css">
  14. <!--
  15. .style1 {font-size: 16px}
  16. .style2 {
  17. color: #FFFFFF;
  18. font-weight: bold;
  19. }
  20. .style4 {color: #000000}
  21. .style5 {color: #FF0000}
  22. body {
  23. margin-top: 0px;
  24. }
  25. -->
  26. </style>
  27. </head>
  28. <body leftmargin="0">
  29. <jsp:useBean id="msg" scope="page" class="cn.js.fan.module.guestbook.MessageDb"/>
  30. <jsp:useBean id="privilege" scope="page" class="com.redmoon.forum.Privilege"/>
  31. <%
  32. if (!privilege.isUserLogin(request))
  33. {
  34. out.print(cn.js.fan.web.SkinUtil.makeErrMsg(request, cn.js.fan.web.SkinUtil.LoadString(request, "pvg_invalid")));
  35. return;
  36. }
  37. String shopCode = ParamUtil.get(request, "shopCode");
  38. if (shopCode.equals("")) {
  39. out.print(StrUtil.Alert("用户名不能为空!"));
  40. return;
  41. }
  42. String user = privilege.getUser(request);
  43. if (!shopCode.equals(user)) {
  44. if (!privilege.isMasterLogin(request)) {
  45. out.print(StrUtil.Alert("对不起,您无权访问!"));
  46. return;
  47. }
  48. }
  49. %>
  50. <table width='100%' cellpadding='0' cellspacing='0' >
  51.   <tr>
  52.     <td class="head">管理留言簿</td>
  53.   </tr>
  54. </table>
  55. <br>
  56. <table width="98%" height="227" border='0' align="center" cellpadding='0' cellspacing='0' class="frame_gray">
  57.   <tr>
  58.     <td height=20 align="left" class="thead">Guestbook</td>
  59.   </tr>
  60.   <tr>
  61.     <td valign="top"><br>
  62. <%
  63. int pagesize = 10;
  64. Paginator paginator = new Paginator(request);
  65. String sql = "select id from guestbook where shopCode=" + StrUtil.sqlstr(shopCode) + " order by lydate desc";
  66. int total = msg.getObjectCount(sql);
  67. paginator.init(total, pagesize);
  68. int curpage = paginator.getCurPage();
  69. //设置当前页数和总页数
  70. int totalpages = paginator.getTotalPages();
  71. if (totalpages==0)
  72. {
  73. curpage = 1;
  74. totalpages = 1;
  75. }
  76. Iterator ri = msg.list(sql, (curpage-1)*pagesize, curpage*pagesize-1).iterator();
  77. String querystr = "shopCode=" + StrUtil.UrlEncode(shopCode);
  78. %>
  79.         <table width="95%" height="24" border="0" align="center" cellpadding="0" cellspacing="0">
  80.           <tr>
  81.             <td align="right"><div>找到符合条件的记录 <b><%=paginator.getTotal() %></b> 条 每页显示 <b><%=paginator.getPageSize() %></b> 条 页次 <b><%=paginator.getCurrentPage() %>/<%=paginator.getTotalPages() %></b></div></td>
  82.           </tr>
  83.         </table>
  84.         <%
  85. while (ri.hasNext()) {
  86.   msg = (MessageDb)ri.next(); %>
  87.         <table width="98%" border="0" align="center" cellpadding="5" cellspacing="0" class="frame_gray">
  88.           <tr bgcolor="#DDE0E6">
  89.             <td width="24%" height="22" valign="bottom" class="stable style4">用户:<%=StrUtil.toHtml(msg.getUserName())%> </td>
  90.             <td width="43%" height="22" valign="bottom" class="stable style4">留言日期:<%=DateUtil.format(msg.getLydate(), "yy-MM-dd HH:mm:ss")%></td>
  91.             <td width="16%" valign="bottom" class="stable style4"><span class="stable"><a href="guestbook_mod.jsp?id=<%=msg.getId()%>&opType=shop&shopCode=<%=StrUtil.UrlEncode(shopCode)%>">修改/回复</a></span></td>
  92.             <td width="17%" valign="bottom" class="stable style4"><span class="stable"><a href="guestbook_del.jsp?id=<%=msg.getId()%>&opType=shop&shopCode=<%=StrUtil.UrlEncode(shopCode)%>">删除</a></span></td>
  93.           </tr>
  94.           <tr valign="top">
  95.             <td height="83" colspan="4" class="stable"><%=StrUtil.toHtml(msg.getContent())%><br>
  96.                 <%
  97.   String reply = StrUtil.getNullString(msg.getReply());
  98.   if (!reply.equals(""))
  99.   {
  100.   %>
  101.                 <font color="#F09F6F"><br>
  102.       回复:</font><%=StrUtil.toHtml(msg.getReply())%> <br>
  103.       回复日期:<%=DateUtil.format(msg.getRedate(), "yy-MM-dd HH:mm:ss")%>
  104.       <%}%>
  105.             </td>
  106.           </tr>
  107.         </table>
  108.         <br>
  109.         <%}
  110. %>
  111.         <br>
  112.         <table width="87%" border="0" cellspacing="1" cellpadding="3" align="center" class="9black">
  113.           <tr>
  114.             <td height="23"><div align="right">
  115.                 <%
  116.     out.print(paginator.getCurPageBlock("guestbook.jsp?"+querystr));
  117. %>
  118.             </div></td>
  119.           </tr>
  120.         </table></td>
  121.   </tr>
  122. </table>
  123. </body>
  124. <SCRIPT language=javascript id=clientEventHandlersJS>
  125. <!--
  126. function form1_onsubmit()
  127. {
  128. if (form1.content.value=="")
  129. {
  130. alert("留言内容不能为空!");
  131. return false;
  132. }
  133. }
  134. //-->
  135. </SCRIPT>
  136. </html>