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

Jsp/Servlet

开发平台:

Java

  1. <%@ page contentType="text/html;charset=utf-8" %>
  2. <%@ include file="../inc/nocache.jsp"%>
  3. <%@ page import="java.net.URLEncoder"%>
  4. <%@ page import="java.sql.ResultSet"%>
  5. <%@ page import="java.sql.SQLException"%>
  6. <%@ page import = "fan.util.ErrMsgException"%>
  7. <html>
  8. <head>
  9. <title>撰写消息</title>
  10. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  11. <LINK href="../common.css" type=text/css rel=stylesheet>
  12. </head>
  13. <body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
  14. <jsp:useBean id="fchar" scope="page" class="cn.js.fan.util.StrUtil"/>
  15. <jsp:useBean id="privilege" scope="page" class="com.redmoon.forum.Privilege"/>
  16. <%
  17. if (!privilege.isUserLogin(request))
  18. response.sendRedirect("../door.jsp");
  19. String name = privilege.getUser(request);
  20. String title,receiver,content,errmsg="";
  21. title = fchar.getNullString(request.getParameter("title"));
  22. receiver = fchar.getNullString(request.getParameter("receiver"));
  23. content = fchar.getNullString(request.getParameter("content"));
  24. if(title.trim().length()==0||content.trim().length()==0)
  25. errmsg += "标题和内容不能为空!n";
  26. if(name.equals(receiver))
  27.    errmsg += "请不要给自己发信息!n";
  28. if(!errmsg.equals(""))
  29. fchar.Alert_Back(errmsg);
  30. if (!privilege.isUserLogin(request))
  31. { %>
  32. <table width="320" border="0" cellspacing="0" cellpadding="0" align="center" class="9black">
  33.   <tr> 
  34.     <td><li>您的登录已过期,请重新登录,如果不是会员请先注册。</td>
  35.   </tr>
  36. </table>
  37. <% } %>
  38. <table width="360" border="0" cellspacing="0" cellpadding="0" align="center">
  39.   <tr>
  40.     <td>&nbsp;</td>
  41.   </tr>
  42. </table>
  43. <table width="320" border="0" cellspacing="1" cellpadding="3" align="center" bgcolor="#99CCFF" class="9black" height="136">
  44.   <tr> 
  45.     <td bgcolor="#CEE7FF" height="23">
  46.         <div align="center"> <b>撰 写 新 消 息</b></div>
  47.     </td>
  48.   </tr>
  49.   <tr> 
  50.     <td bgcolor="#FFFFFF" height="50"> 
  51.         <table width="300" border="0" cellspacing="0" cellpadding="0" align="center">
  52.           <tr> 
  53.             <td width="75"> 
  54.               <div align="center"><a href="message.jsp?page=1"><img src="images/inboxpm.gif" width="40" height="40" border="0"></a></div>
  55.             </td>
  56.             <td width="75"> 
  57.               <div align="center"><a href="mysend.jsp"><img src="images/m_outbox.gif" width="40" height="40" border="0"></a></div>
  58.             </td>
  59.             <td width="75"> 
  60.               <div align="center"><a href="send.jsp"><img src="images/newpm.gif" width="40" height="40" border="0"></a></div>
  61.             </td>
  62.             <td width="75"> 
  63.               <div align="center"> <img src="images/m_delete.gif" width="40" height="40"></div>
  64.             </td>
  65.           </tr>
  66.         </table>
  67.     </td>
  68.   </tr>
  69.   <tr> 
  70.       <td bgcolor="#FFFFFF" height="152" valign="top">
  71.         <table width="300" border="0" cellspacing="0" cellpadding="0" align="center" class="9black" height="6">
  72.           <tr> 
  73.             <td></td>
  74.           </tr>
  75.         </table>
  76.         <table width="300" border="0" cellspacing="1" cellpadding="3" align="center" class="9black">
  77.           <tr> 
  78.             
  79.           <td height="35"> <li>
  80. <jsp:useBean id="Msg" scope="page" class="com.redmoon.forum.message.MessageDb"/>
  81. <%
  82. boolean isSuccess = false;
  83. try {
  84. isSuccess = Msg.AddMsg(request);
  85. }
  86. catch (ErrMsgException e) {
  87. out.println(fchar.makeErrMsg("消息发送失败:"+e.getMessage()));
  88. }
  89. Msg.clear();
  90. %>
  91. <% if (isSuccess) { %>
  92.               消息发送成功!
  93. <% } %>
  94.   
  95.   </td>
  96.           </tr>
  97.           <tr> 
  98.             <td height="35"> 
  99.               <div align="center"></div>
  100.             </td>
  101.           </tr>
  102.           <tr> 
  103.             <td height="35"> 
  104.               <div align="center"></div>
  105.             </td>
  106.           </tr>
  107.           <tr> 
  108.             <td height="35"> 
  109.               <div align="center"> </div>
  110.             </td>
  111.           </tr>
  112.         </table>
  113.         <table width="300" border="0" cellspacing="0" cellpadding="0" align="center" class="9black" height="6">
  114.           <tr> 
  115.             <td></td>
  116.           </tr>
  117.         </table>
  118.       </td>
  119.   </tr>
  120.   <tr> 
  121.     <td bgcolor="#CEE7FF" height="6"></td>
  122.   </tr>
  123. </table>
  124. </body>
  125. </html>