checkin_admin.java
上传用户:manager48
上传日期:2022-07-31
资源大小:997k
文件大小:2k
- /*****************************************************************
- * Date:2007-05-10 *
- * File:checkin_admin.java *
- * Author:jezz *
- *****************************************************************/
- package wm.servlet;
- import java.util.*;
- import java.sql.*;
- import java.io.*;
- import javax.servlet.*;
- import javax.servlet.http.*;
- import javax.servlet.http.HttpSession.*;
- import wm.bean.messFun;
- public class checkin_admin extends HttpServlet
- {
- public void init() throws ServletException
- {
- }
-
- public void doGet(HttpServletRequest request,HttpServletResponse response)
- throws ServletException,IOException
- {
- messFun MF =new messFun();
- response.setContentType("text/html;charset=GBK");
- HttpSession session=request.getSession();
- String yhm1 = request.getParameter("yhm");
- String yhmm1 = request.getParameter("yhmm");
- String rand = (String)session.getAttribute("rand");//读取session的值
- String code = request.getParameter("rand");
- String msg="";
- if(yhm1=="")
- msg+="<li>用户名不能为空</li>";
- if(yhmm1=="")
- msg+="<li>密码不能为空</li>";
- if(!rand.equals(code))
- msg+="<li>验证码不正确</li>";
- if(msg.equals(""))
- {
- boolean result=MF.checkLogin(yhm1,yhmm1);
- if(result==true)
- {
- session.setAttribute("login","1");
- response.sendRedirect("index.jsp");
- }
- else
- {
- msg+="<li>用户名或密码不对</li>";
- request.setAttribute("msg",msg);
- RequestDispatcher wm =request.getRequestDispatcher("common.jsp");
- wm.forward(request,response);
- }
-
-
-
- }
- else
- {
- request.setAttribute("msg",msg);
- RequestDispatcher wm=request.getRequestDispatcher("common.jsp");
- wm.forward(request,response);
- }
- }
-
- public void doPost(HttpServletRequest request,HttpServletResponse response)
- throws ServletException,IOException
- {
- doGet(request,response);
- }
-
- public void destroy()
- {
- }
- }