首页>代码>基于spring+springMVC+mybatis+easyui技术实现的医药后台管理系统>/MMS/src/main/java/mms/controller/LoginController.java
package mms.controller;
import java.util.Enumeration;
import javax.servlet.http.HttpSession;
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.ResponseBody;
import mms.services.LoginService;
//处理登陆逻辑
@RequestMapping("Login")
@Controller
public class LoginController {
@Autowired
private LoginService loginService;
/*
* 用户登陆 判断是否存在用户 存在保存session
*/
@RequestMapping(value = "loginUser", produces = "text/html;charset=UTF-8")
@ResponseBody
public String login(String username, String password, HttpSession session) {
return loginService.login(username, password, session);
}
// 取出seeion的用户名
@RequestMapping("GetLoginName")
@ResponseBody
public Object GetLoginName(HttpSession session) {
Object username = session.getAttribute("user");
return username;
}
// 清除session
@RequestMapping("LogOff")
@ResponseBody
public void logOff(HttpSession session) {
Enumeration em = session.getAttributeNames();
while (em.hasMoreElements()) {
session.removeAttribute(em.nextElement().toString());
}
}
}
最近下载更多
fellowfun LV12
2023年12月4日
KAIzx11 LV8
2023年6月15日
LITIANYU084414 LV11
2023年1月4日
wcy071213 LV27
2022年12月8日
2931765614 LV2
2022年11月4日
testuser1234567 LV24
2022年6月30日
葡萄树下酒庄 LV9
2022年1月4日
幸运疯子 LV13
2021年12月20日
hulahula123 LV4
2021年12月16日
893213895 LV18
2021年12月16日
最近浏览更多
奋斗的小蚂蚁 LV17
10月17日
dddding yang LV6
9月16日
酷少小新 LV2
6月8日
Yj123456k LV2
5月12日
苯科仔
2024年12月16日
暂无贡献等级
krispeng LV15
2024年11月19日
Sean_admin LV7
2024年8月8日
fengst
2024年6月18日
暂无贡献等级
大魔王help
2024年6月11日
暂无贡献等级
飃go with wind
2024年5月7日
暂无贡献等级

