post.java
上传用户:manager48
上传日期:2022-07-31
资源大小:997k
文件大小:2k
源码类别:

Jsp/Servlet

开发平台:

Java

  1. /*****************************************************************
  2.                         *  Date:2007-05-10   *
  3.                         *  File:post.java    *
  4.                         *  Author:jezz       *
  5. *****************************************************************/
  6. package wm.servlet;
  7. import java.util.*;
  8. import java.sql.*;
  9. import java.io.*;
  10. import javax.servlet.*;
  11. import javax.servlet.http.*;
  12. import wm.bean.messFun;
  13. public class post extends HttpServlet{
  14. public void init() throws ServletException
  15. {
  16. }
  17. public void doGet(HttpServletRequest request,HttpServletResponse response) throws IOException,ServletException
  18. {
  19. messFun MF=new messFun();
  20. String id="";
  21. String content_reply="";
  22. String msg="";
  23. if(request.getParameter("id")!=null)
  24. id=request.getParameter("id");
  25. else
  26. msg+="<li>ID不存在</li>";
  27. if(request.getParameter("content_reply")!="")
  28. content_reply=request.getParameter("content_reply");
  29. else
  30. msg+="<li>内容不能为空</li>";
  31. if(msg.equals(""))
  32. {
  33.         boolean result=MF.postMess(id,content_reply);
  34. if(result==true)
  35.                                 msg+="<li>回复成功</li>";
  36. else
  37. msg+="<li>回复失败</li>";
  38.                         request.setAttribute("msg",msg);
  39. RequestDispatcher wm =request.getRequestDispatcher("common.jsp");
  40. wm.forward(request,response);
  41. }
  42. else
  43. {
  44.                         request.setAttribute("msg",msg);
  45. RequestDispatcher wm =request.getRequestDispatcher("common.jsp");
  46. wm.forward(request,response);
  47. }
  48. }
  49. public void doPost(HttpServletRequest request,HttpServletResponse response) throws IOException,ServletException
  50. {
  51. doGet(request,response);
  52. }
  53. public void destroy()
  54. {
  55. }
  56. }