销毁 Session 和 Cookie
代码语言:javascript
复制private static void resetCookie(HttpServletRequest request, HttpServletResponse response) {
Cookie userCodeCookie = new Cookie("userCode", null);
Cookie userNickname = new Cookie("userNickname", null);
Cookie userTableName = new Cookie("userTableName", null);
userCodeCookie.setMaxAge(0);
userNickname.setMaxAge(0);
userTableName.setMaxAge(0);
userCodeCookie.setPath("/");
userNickname.setPath("/");
userTableName.setPath("/");
response.addCookie(userCodeCookie);
response.addCookie(userNickname);
response.addCookie(userTableName);
request.getSession().invalidate();
}