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

Jsp/Servlet

开发平台:

Java

  1. /*****************************************************************
  2.                         *  Date:2007-05-10         *
  3.                         *  File:checkin_admin.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 javax.servlet.http.HttpSession.*;
  13. import wm.bean.messFun;
  14. public class checkin_admin extends HttpServlet
  15. {
  16. public void init() throws ServletException
  17. {
  18. }
  19. public void doGet(HttpServletRequest request,HttpServletResponse response)
  20. throws ServletException,IOException
  21. {
  22. messFun MF =new messFun();
  23.                 response.setContentType("text/html;charset=GBK");
  24. HttpSession session=request.getSession();
  25. String yhm1 = request.getParameter("yhm");
  26. String yhmm1 = request.getParameter("yhmm");
  27. String rand = (String)session.getAttribute("rand");//读取session的值
  28. String code = request.getParameter("rand");
  29. String msg="";
  30. if(yhm1=="")
  31. msg+="<li>用户名不能为空</li>";
  32. if(yhmm1=="")
  33. msg+="<li>密码不能为空</li>";
  34. if(!rand.equals(code))
  35. msg+="<li>验证码不正确</li>";
  36. if(msg.equals(""))
  37. {
  38.         boolean result=MF.checkLogin(yhm1,yhmm1);
  39. if(result==true)
  40. {
  41. session.setAttribute("login","1");
  42. response.sendRedirect("index.jsp");
  43. }
  44. else
  45. {
  46. msg+="<li>用户名或密码不对</li>";
  47. request.setAttribute("msg",msg);
  48.                                 RequestDispatcher wm =request.getRequestDispatcher("common.jsp");
  49. wm.forward(request,response);
  50. }
  51. }
  52. else
  53. {
  54. request.setAttribute("msg",msg);
  55. RequestDispatcher wm=request.getRequestDispatcher("common.jsp");
  56. wm.forward(request,response);
  57. }
  58. }
  59. public void doPost(HttpServletRequest request,HttpServletResponse response)
  60. throws ServletException,IOException
  61. {
  62. doGet(request,response);
  63. }
  64. public void destroy()
  65. {
  66. }
  67. }