退出登录功能

来源:互联网 发布:淘宝专业盗图 编辑:程序博客网 时间:2024/05/16 11:06

js代码:

$(".logout").click(function() {if (confirm('系统提示,您确定要退出本次登录吗?')) {location.href = ctx + '/logout';}});

jsp代码:

<a href="#" class="logout">安全退出</a>

java代码:

@RequestMapping(value = "/logout")public String logout(HttpSession httpSession) {Student student = (Student) httpSession.getAttribute("currentUser");if(null != student) {httpSession.removeAttribute("currentUser");}return "redirect:/index";}


原创粉丝点击