employeeManager-master/src/main/java/com/suny/controller/LoginController.java
(开头部分) 5KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
package com.suny.controller;
import com.suny.entity.Employee;
import com.suny.service.EmpManagerService;
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 org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.view.RedirectView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
/**
* 主要处理用户登陆登出请求
* 孙建荣
* 2016/12/12 13:03
*/
@Controller
public class LoginController {
@Autowired
private EmpManagerService empManagerServiceImpl;
/**
* 处理用户的注销登陆请求,在注销的同时讲保存在session中的用户名进行注销处理
* @param request 包含用户请求的相关信息
*/
@RequestMapping("logout")
public String logout(HttpServletRequest request) {
request.getSession().removeAttribute("username"); //移除session用户名
return "login"; //返回登陆
}
/**
* 当用户登陆成功,身份为普通成员身份后的请求
*
* @return 普通用户界面
*/
@RequestMapping("userWeb")
public String user_index() {
return "pages/userView/user_index";
}
/**
* 管理员用户登陆成功后,进入管理员页面
*
* @param request request请求,包含用户页面相关的属性
* @return 管理员页面
*/
@RequestMapping(value = {"/adminWeb", "", "/", "/index", "/index.jsp", "/login"})
public String index(HttpServletRequest request) {
String uri; //定义一个跳转地址变量
if (request.getSession().getAttribute("username") == null) { //判断session中是否有记录,否则就重定向到登陆界面
后面还有 61 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
