【发布时间】:2011-09-22 10:38:27
【问题描述】:
我在 Sof link 上找到了这个解决方案 但我不得不从两个原因改变它:
- 没有.getFacesContext() 功能
- 我没有特定的 cookie 文件 (见行 ourcookiename=yourcookievalue)
我的代码如下所示:
FacesContext facesContext = FacesContext.getCurrentInstance();
HttpServletResponse response = (HttpServletResponse) facesContext.getExternalContext().getResponse();
response.addHeader("Set-Cookie", "; HTTPOnly");
原代码
FacesContext facesContext = FacesContext.getCurrentInstance().getFacesContext();
HttpServletResponse response = (HttpServletResponse) facesContext.getExternalContext().getResponse();
response.addHeader("Set-Cookie", "yourcookiename=yourcookievalue; HTTPOnly");
如果我错了,请纠正我。提前谢谢你
【问题讨论】: