现在的位置: 首页 > 综合 > 正文

退出登录功能

2012年08月09日 ⁄ 综合 ⁄ 共 372字 ⁄ 字号 评论关闭

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";
	}

抱歉!评论已关闭.