package com.rainnie.controller; import javax.servlet.http.HttpSession; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import com.rainnie.po.User; import com.rainnie.service.UserService; @Controller public class UserController { @Autowired private UserService userService; @RequestMapping("login.action") public String login(String usercode,String password,Model model,HttpSession session) { User user=(User) userService.findUser(usercode, password); if(user!=null) { session.setAttribute("USER_SESSION", user); /*return "customer";*/ return "redirect:customer/list.action"; } model.addAttribute("msg", "账号或者密码错误"); return "login"; } @RequestMapping("logout.action") public String logout(HttpSession session) { session.invalidate(); return "redirect:tologin.action"; } @RequestMapping("tologin.action") public String toLogin() { return "login"; } /** * 此处是模拟没有拦截器登录的情况,没有实质作用 * @return */ @RequestMapping("toCustomer.action") public String toCustomer() { return "customer"; } }
最近下载更多
wananall LV13
3月13日
wuge123 LV8
2023年12月19日
枫林与爱00 LV1
2023年10月11日
周敏国 LV9
2023年9月4日
zcx12345678 LV6
2023年5月16日
Peri_qxy LV2
2023年3月29日
黑 LV6
2023年3月29日
taoshen95 LV14
2022年12月11日
WANFYUEYANG LV1
2022年12月5日
五菱宏光 LV1
2022年9月29日
最近浏览更多
ChenZheMeng LV3
3月22日
爱丽淇 LV5
3月13日
wananall LV13
3月12日
KIKO666
2月21日
暂无贡献等级
阿凡达 LV9
1月29日
shenghaer LV1
1月26日
XiaoSong888 LV2
1月10日
微信网友_6808943745421312 LV1
1月5日
微信网友_6255730581377024 LV1
1月3日
WBelong LV6
2023年12月26日