1. 程式人生 > >清除session ,清除cookie

清除session ,清除cookie

清除session

SysContent.getSession().invalidate(); //清除session

清除cookie

//清除cookie
		HttpServletRequest request = SysContent.getRequest();
		Cookie killcookie = CookieUtil.getCookieByName(request, "user");
		killcookie.setValue(null);
		killcookie.setMaxAge(0);
		killcookie.setPath("/");
		HttpServletResponse response = SysContent.getResponse();
		response.addCookie(killcookie);