guestbook_mod.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.module.guestbook.*"%>
  5. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  6. <HTML><HEAD><TITLE>留言簿管理</TITLE>
  7. <META http-equiv=Content-Type content="text/html; charset=utf-8">
  8. <link rel="stylesheet" href="../common.css" type="text/css">
  9. <LINK href="default.css" type=text/css rel=stylesheet>
  10. <META content="MSHTML 6.00.2600.0" name=GENERATOR>
  11. <style type="text/css">
  12. <!--
  13. .style1 {
  14. font-size: 16px;
  15. font-weight: bold;
  16. }
  17. -->
  18. </style>
  19. </HEAD>
  20. <BODY bgColor=#ffffff leftMargin=0 topMargin=3 marginheight="3" marginwidth="0">
  21. <table width='100%' cellpadding='0' cellspacing='0' >
  22.   <tr>
  23.     <td class="head">管理留言</td>
  24.   </tr>
  25. </table>
  26. <br>
  27. <TABLE class="frame_gray"  
  28. cellSpacing=0 cellPadding=0 width="95%" align=center>
  29.   <TBODY>
  30.     <TR>
  31.       <TD height=200 valign="top" bgcolor="#FFFBFF"><table width="494" border="0" align="center" cellpadding="0" cellspacing="0">
  32.         <tr>
  33.           <td valign="top" background="../images/tab-b-back.gif"><jsp:useBean id="privilege" scope="page" class="com.fan.redmoon.Privilege"/>
  34.             
  35.               <%
  36. if (!privilege.isAdmin(request))
  37. {
  38. out.println(cn.js.fan.web.SkinUtil.makeErrMsg(request, cn.js.fan.web.SkinUtil.LoadString(request, "pvg_invalid")));
  39. return;
  40. }
  41. String id = request.getParameter("id");
  42. if (id==null || !StrUtil.isNumeric(id))
  43. {
  44. out.println(StrUtil.makeErrMsg("未选择留言标识!"));
  45. return;
  46. }
  47. %>
  48.               <jsp:useBean id="msgmgr" scope="page" class="cn.js.fan.module.guestbook.MessageMgr"/>
  49.               
  50.               <%
  51. String dowhat = StrUtil.getNullString(request.getParameter("dowhat"));
  52. if (dowhat.equals("modify"))
  53. {
  54. String content = StrUtil.getNullString(StrUtil.UnicodeToUTF8(request.getParameter("content")));
  55. if (content.equals(""))
  56. {
  57. out.println(StrUtil.Alert("留言内容不能为空!"));
  58. }
  59. else
  60. {
  61. String reply = StrUtil.getNullString(StrUtil.UnicodeToUTF8(request.getParameter("reply")));
  62. boolean re = false;
  63. try {
  64. re = msgmgr.update(Integer.parseInt(id), content, reply);
  65. }
  66. catch (ErrMsgException e) {
  67. out.print(StrUtil.makeErrMsg(e.getMessage()));
  68. }
  69. if (re)
  70. out.print(StrUtil.Alert("更新留言成功!"));
  71. }
  72. }
  73. Message msg = msgmgr.get(Integer.parseInt(id));
  74. %>
  75.               <br>
  76.               <table width="89%" border="0" align="center" cellpadding="0" cellspacing="0" class="p9">
  77.                 <form name="form1" action="guestbook_mod.jsp" method="post" onSubmit="">
  78.                   <tr>
  79.                     <td width="15%" height="21" align="center" bgcolor="#eeeeee" class="stable">用户名</td>
  80.                     <td width="31%" height="21" bgcolor="#eeeeee" class="stable"><%=StrUtil.toHtml(msg.getUserName())%></td>
  81.                     <td width="54%" height="21" bgcolor="#eeeeee" class="stable">时间 <%=msg.getDate()%>
  82.                         <input type=hidden name="id" value="<%=id%>">
  83.                         <input type=hidden name=dowhat value="modify"></td>
  84.                   </tr>
  85.                   <tr>
  86.                     <td width="15%" height="17" align="center" bgcolor="#eeeeee" class="stable">内&nbsp;&nbsp;容</td>
  87.                     <td height="17" colspan="2" bgcolor="#eeeeee" class="stable"><textarea name=content rows=10 cols="45"><%=StrUtil.toHtml(msg.getContent())%></textarea>
  88.                         <br>
  89.                     </td>
  90.                   </tr>
  91.                   <tr>
  92.                     <td width="15%" height="58" align="center" bgcolor="#eeeeee" class="stable">回&nbsp;&nbsp;复</td>
  93.                     <td height="58" colspan="2" bgcolor="#eeeeee" class="stable"><textarea name=reply rows=10 cols="45"><%=msg.getReply()%></textarea>
  94.                     </td>
  95.                   </tr>
  96.                   <tr>
  97.                     <td height="22" align="center" bgcolor="#eeeeee" class="stable">回复时间</td>
  98.                     <td height="22" colspan="2" align="left" bgcolor="#eeeeee" class="stable"><%
  99. if (!msg.getReDate().equals("")) {
  100. out.print(msg.getReDate());
  101. }%>
  102. &nbsp;</td>
  103.                   </tr>
  104.                   <tr>
  105.                     <td colspan="3" align="center"><input type=submit value="发送" name="submit">
  106. &nbsp;&nbsp;
  107.               <input type=reset value="取消" name="reset">
  108.                     </td>
  109.                   </tr>
  110.                 </form>
  111.             </table></td>
  112.         </tr>
  113.         <tr>
  114.           <td height="9">&nbsp;</td>
  115.         </tr>
  116.       </table></TD>
  117.     </TR>
  118.   </TBODY>
  119. </TABLE>
  120. </BODY></HTML>