1、在jsp顶部加入<%@ page isELIgnored="false" %>
2、${sessionScope.student.xxx} xx是自己的成员变量
后端代码
@ResponseBody @PostMapping("/login") public String loginPost(String username, String password, String sN, HttpSession session) { Student student = studentService.login(username, password, sN); if (student == null) { return "102";//登录失败 } else { session.setAttribute("student",student); session.setMaxInactiveInterval(7200); return "101";//登录成功 } }