更新时间:2023-09-13 23:43:52
您的答案似乎是***的.另一种方法是以这种方式直接操作厨师:
Your answer seems optimal. Another way would be to directly manipulate cookes in this fashion:
Cookie cookie = new Cookie ("JSESSIONID", "randomValue");
cookie.setMaxAge( 0 );
因此您创建了一个具有相同名称的新cookie并立即将其过期,但是我不建议这样做,因为对于熟悉基本Servlet API的任何人来说,您的cookie都更加简洁明了
so you create a new cookie with the same name and immediately expire it, but I don't recommend going this way since yours is much cleaner and pretty obvious to anyone who's familiar with basic Servlet APIs.