其他分享
首页 > 其他分享> > UserController

UserController

作者:互联网

package cn.edu.hncj.controller;

import cn.edu.hncj.pojo.User;
import cn.edu.hncj.service.IUserService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.servlet.http.HttpServletRequest;

@Controller
public class UserController {
@Autowired
private IUserService userService;
@RequestMapping(value = "/userLogin",method = RequestMethod.POST)
public String userLogin(@Param("username")String username, @Param("password")String password, HttpServletRequest request){
System.out.println(username+password);
User userLogin= userService.userLogin(username,password);
if(userLogin==null){
request.setAttribute("msg","用户名或密码错误!!");
return "forward:login.jsp";
}

return "redirect:success.jsp";
}
}

 

标签:username,password,userLogin,springframework,org,import,UserController
来源: https://www.cnblogs.com/614515430wxq/p/16311431.html