首页>代码>基于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  LV7 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日
最近浏览更多
WBelong  LV7 4月2日
superqi 1月1日
暂无贡献等级
夜起星河  LV8 2023年12月29日
erqiu2013  LV18 2023年12月27日
Murmure  LV2 2023年12月21日
1012094499 2023年12月10日
暂无贡献等级
fellowfun  LV12 2023年12月4日
仙女山的月亮  LV2 2023年11月26日
lingmingcx 2023年11月23日
暂无贡献等级
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友