当我添加如下cookie时:
FacesContext.getCurrentInstance().getExternalContext().addResponseCookie("Test", "Test", null);
Run Code Online (Sandbox Code Playgroud)
然后它运行良好,但cookie成为最大年龄为的会话cookie -1.
当我尝试如下:
Map<String, Object> properties = new HashMap<>();
properties.put("domain", "test");
properties.put("maxAge", 31536000);
properties.put("secure", false);
properties.put("path","/");
FacesContext.getCurrentInstance().getExternalContext().addResponseCookie("Test", "Test", properties);
Run Code Online (Sandbox Code Playgroud)
然后我在任何地方都看不到cookie.我不明白为什么.
我正在使用Tomcat 7.