首页>代码>spring+spring mvc+mybatis+jsp实现简单学生信息管理系统>/StudentDemo/src/com/ms/ssm/controller/LoginController.java
package com.ms.ssm.controller;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.context.support.WebApplicationContextUtils;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.view.RedirectView;

import com.ms.ssm.pojo.User;

import com.ms.ssm.service.UserService;

@Controller
public class LoginController {

	@Autowired
	private UserService userServiceImpl;
	
	@RequestMapping("login")
	public String LoginController(HttpServletRequest request, HttpServletResponse reponse,
			User user,Model model) throws Exception{
			
			user.setUsername(request.getParameter("username"));
			user.setPassword(request.getParameter("password"));
			
				User aaa=userServiceImpl.CheckLogin(user);
				if(aaa!=null){
					model.addAttribute("username", user.getUsername());
					return "Loginsuccess";
			}else{
			return "Loginfail";
		}
	}
}
最近下载更多
xiaolu-123  LV1 4月9日
wwwww816  LV3 2023年12月19日
李亮  LV19 2023年8月29日
磊少不在  LV2 2023年6月18日
tmf852  LV5 2023年6月18日
2819271872  LV1 2023年6月16日
1257592068  LV6 2023年6月13日
guyusky  LV2 2023年6月6日
6389181  LV7 2023年6月1日
_Yown_  LV3 2023年5月31日
最近浏览更多
wujianhao1105 4月21日
暂无贡献等级
xiaolu-123  LV1 4月9日
WBelong  LV7 4月2日
潘潘123456  LV2 3月2日
像风似你  LV2 2月29日
3320151533  LV1 1月7日
zhangjilu  LV18 1月1日
zzzzzzz09173 2023年12月27日
暂无贡献等级
wwwww816  LV3 2023年12月19日
李朝磊  LV18 2023年12月17日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友