Home > Back-end >  302 redirect
302 redirect

Time:09-16


When I quit access exit can delete data according to a 302, user data is still there, want to refresh the page and the data how to solve this problem???



Public void exit (it request, HttpServletResponse response) throws ServletException, IOException {
//destroy data
//request. GetSession (). Invalidate ();
//get all the cookies
Cookie[] cookies=request.getCookies();
//remove all cookies
For (Cookie c: cookies) {
C.s. etValue (null);
C.s. etMaxAge (0);
Be sad etValue chtistina georgina rossetti.british poetess System. Out. Println (());
}

//redirected to the login page
The response. SendRedirect (request. GetContextPath () + "/login HTML");

}


Public void findOne (it request, HttpServletResponse response) throws ServletException, IOException {

//get all the cookies
Cookie[] cookies=request.getCookies();
//out own cookies
For (Cookie c: cookies) {
Be sad etName chtistina georgina rossetti.british poetess if ((.) equalsIgnoreCase (" JSESSIONID ")) {
C.s. etMaxAge (0);
C.s. etValue (null);
}
}
If (cookies [0]. GetName ()!=null & amp; & Cookies [0]. GetValue ()!=null) {
String name=cookies [0]. GetValue ();
User user=new User();
User. Elegantly-named setName (name);

//return data to the client
WriteValue (user, response);
} else {

WriteValue (null, response);
}
  • Related