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

Jsp/Servlet

开发平台:

Java

  1. <%@ page contentType="text/html;charset=gb2312"%>
  2. <%@ page import = "java.net.URLEncoder"%>
  3. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  4. <HTML><HEAD><TITLE>留言簿管理</TITLE>
  5. <META http-equiv=Content-Type content="text/html; charset=gb2312">
  6. <link rel="stylesheet" href="../common.css" type="text/css">
  7. <META content="MSHTML 6.00.2600.0" name=GENERATOR></HEAD>
  8. <BODY bgColor=#ffffff leftMargin=0 topMargin=3 marginheight="3" marginwidth="0">
  9. <%@ include file="../inc/inc.jsp"%>
  10. <jsp:useBean id="fchar" scope="page" class="cn.js.fan.util.StrUtil"/>
  11. <jsp:useBean id="privilege" scope="page" class="com.redmoon.oa.pvg.Privilege"/>
  12. <jsp:setProperty name="privilege" property="defaulturl" value="../index.jsp"/>
  13. <!--重定向至 :<jsp:getProperty name="privilege" property="defaulturl"   />-->
  14. <table width="494" border="0" align="center" cellpadding="0" cellspacing="0">
  15.   <tr> 
  16.     <td height="23" valign="bottom" background="../images/tab-b5-top.gif">     <span class="right-title">回 
  17.       复 留 言</span></td>
  18.   </tr>
  19.   <tr> 
  20.     <td valign="top" background="../images/tab-b-back.gif">
  21.         <%
  22. String priv="admin";
  23. if (!privilege.isUserPrivValid(request,priv))
  24. {
  25. out.println(cn.js.fan.web.SkinUtil.makeErrMsg(request, cn.js.fan.web.SkinUtil.LoadString(request, "pvg_invalid")));
  26. return;
  27. }
  28. %>
  29.         <%
  30. String id = request.getParameter("id");
  31. if (id!=null && fchar.isNumeric(id))
  32. ;
  33. else
  34. {
  35. out.println(fchar.makeErrMsg("未选择留言标识!"));
  36. return;
  37. }
  38. %>
  39.         <jsp:useBean id="conn" scope="page" class="com.redmoon.oa.db.Conn"/>
  40.         <jsp:setProperty name="conn" property="POOLNAME" value="ttoa"/>
  41.         <%
  42. String person="",lydate="",ip="",content="",reply="";
  43. String dowhat = fchar.getNullString(request.getParameter("dowhat"));
  44. String redate = "";
  45. String sql = "";
  46. if (dowhat.equals("modify"))
  47. {
  48. content = fchar.getNullString(fchar.UnicodeToGB(request.getParameter("content")));
  49. if (content.equals(""))
  50. {
  51. conn.close();
  52. out.println(fchar.makeErrMsg("留言内容不能为空!"));
  53. return;
  54. }
  55. reply = fchar.getNullString(fchar.UnicodeToGB(request.getParameter("reply")));
  56. redate = (new java.util.Date()).toString();
  57. sql = "update guestbook set content="+fchar.sqlstr(content)+",reply="+fchar.sqlstr(reply)+",redate=getDate() where id="+id;
  58. conn.executeUpdate(sql);
  59. }
  60. sql = "select * from guestbook where id="+id;
  61. ResultSet rs = conn.executeQuery(sql);
  62. if (rs!=null && rs.next())
  63. {
  64. id = rs.getString("id");
  65. person = rs.getString("person");
  66. lydate = rs.getString("lydate");
  67. ip = rs.getString("ip");
  68. content = rs.getString("content");
  69. reply = fchar.getNullString(rs.getString("reply"));
  70. redate = fchar.getNullString(rs.getString("redate"));
  71. }
  72. if (rs!=null)
  73. rs.close();
  74. conn.close();
  75. %>
  76.         <br>
  77.       <table width="85%" border="0" align="center" cellpadding="0" cellspacing="0" class="p9">
  78.         <form name="form1" action="guestbook_mod.jsp" method="post" onSubmit="">
  79.           <tr> 
  80.             <td width="15%" height="21" align="center" bgcolor="#eeeeee" class="stable">标&nbsp;&nbsp;识</td>
  81.             <td height="21" colspan="2" class="stable"> <%=id%> <input type=hidden name="id" value="<%=id%>"> <input type=hidden name=dowhat value="modify"> 
  82.             </td>
  83.           </tr>
  84.           <tr> 
  85.             <td width="15%" height="21" align="center" bgcolor="#eeeeee" class="stable">用户名</td>
  86.             <td width="31%" height="21" class="stable"><%=fchar.toHtml(person)%></td>
  87.             <td width="54%" height="21" class="stable">时间 <%=lydate.substring(0,19)%></td>
  88.           </tr>
  89.           <tr> 
  90.             <td width="15%" height="17" align="center" bgcolor="#eeeeee" class="stable">内&nbsp;&nbsp;容</td>
  91.             <td height="17" colspan="2" class="stable"> 
  92.               <textarea name=content rows=10 cols="50"><%=content%></textarea> 
  93.               <br> </td>
  94.           </tr>
  95.           <tr> 
  96.             <td width="15%" height="58" align="center" bgcolor="#eeeeee" class="stable">回&nbsp;&nbsp;复</td>
  97.             <td height="58" colspan="2" class="stable"> 
  98.               <textarea name=reply rows=10 cols="50"><%=reply%></textarea> 
  99.             </td>
  100.           </tr>
  101.           <tr> 
  102.             <td height="22" align="center" bgcolor="#eeeeee" class="stable">回复时间</td>
  103.             <td height="22" colspan="2" align="left" class="stable">
  104. <%
  105. if (!redate.equals("")) {
  106. out.print(redate.substring(0,19));
  107. }%>
  108. &nbsp;</td>
  109.           </tr>
  110.           <tr> 
  111.             <td colspan="3" align="center"> <input type=submit value="发送" name="submit">
  112.               &nbsp;&nbsp; 
  113.               <input type=reset value="取消" name="reset"> </td>
  114.           </tr>
  115.         </form>
  116.       </table></td>
  117.   </tr>
  118.   <tr> 
  119.     <td height="9"><img src="../images/tab-b-bot.gif" width="494" height="9"></td>
  120.   </tr>
  121. </table>
  122. </BODY></HTML>