我需要sessionDestroyed
方法中的Request對象,因爲我需要在那裏檢索Cookie。如何在sessionDestroyed方法中獲取請求對象?
public void sessionDestroyed(HttpSessionEvent httpSessionEvent)
{
// Here I need to get Request object so that I can retrieve Cookies.
}
是否有可能得到request
對象,以便我可以檢索餅乾呢?
我有2個JSP表單(form1&form2)。渲染這些表單是基於Cookie值決定的。當用戶保持空閒(說)15分鐘時,會話正在被破壞,其他值正在刷新,但Cookie未被清除,無法重定向到正確的表單。而是呈現其他不正確的形式。因此我想''sessionDestroyed'方法清除cookie。 –
只需將其設置爲會話cookie(將'maxAge'設置爲'-1'),以便在會話結束時自動銷燬它。 – BalusC