首页>代码>java高仿酷狗音乐网站>/[www.java1234.com]jsp模拟酷狗官网/KugouProject/src/com/tian/cotrller/AdminLogin.java
package com.tian.cotrller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.tian.entity.Admins;
import com.tian.entity.Record;
import com.tian.service.AdminService;
import com.tian.service.RecordService;
import com.tian.service.impl.AdminServiceImpl;
import com.tian.service.impl.RecordServiceImpl;

public class AdminLogin extends HttpServlet {

	/**
	 * The doGet method of the servlet. <br>
	 *
	 * This method is called when a form has its tag value method equals to get.
	 * 
	 * @param request the request send by the client to the server
	 * @param response the response send by the server to the client
	 * @throws ServletException if an error occurred
	 * @throws IOException if an error occurred
	 */
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		response.setCharacterEncoding("gbk");
		HttpSession session = request.getSession();
		PrintWriter out = response.getWriter();
		String name = request.getParameter("name");
		String pwd = request.getParameter("pwd");
		String ip = request.getRemoteAddr();
		
		Record r = new Record(ip,name);
		
		RecordService rs = new RecordServiceImpl();
		rs.recordInfo(r);
		
		
		AdminService adminService = new AdminServiceImpl();
		Admins admins = adminService.getAllAdminInfo(name, pwd);
		boolean result = false;
		if(admins != null){
			session.setAttribute("admins", admins);
			result = true;
			out.print(result);
			out.close();
		}
		
	}

	/**
	 * The doPost method of the servlet. <br>
	 *
	 * This method is called when a form has its tag value method equals to post.
	 * 
	 * @param request the request send by the client to the server
	 * @param response the response send by the server to the client
	 * @throws ServletException if an error occurred
	 * @throws IOException if an error occurred
	 */
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		this.doGet(request, response);
	}

}
最近下载更多
过桥次米线  LV2 2022年12月7日
liqingzhao6  LV12 2022年9月12日
gaojia993  LV1 2022年5月14日
听雨轩丿  LV10 2022年3月14日
我在家喝小叮当  LV2 2022年1月5日
cc52013  LV1 2021年12月13日
gfg1313  LV1 2021年11月2日
cc123456RR  LV5 2021年10月27日
小狮子12  LV1 2021年1月5日
2391490703  LV7 2020年12月27日
最近浏览更多
erqiu2013  LV18 2023年12月27日
西瓜哥哥  LV4 2023年12月17日
蹇金金  LV7 2023年11月7日
余生1234 2023年11月3日
暂无贡献等级
xk16675552250  LV33 2023年10月7日
2036495585  LV9 2023年9月26日
cmq258159  LV2 2023年6月20日
慕雨芩羽秋  LV1 2023年6月20日
runbey6666  LV2 2023年6月8日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友