title: How to add cookie in JSF?
body: <p>When I add a cookie as below:</p>
  
  <pre><code>FacesContext.getCurrentInstance().getExternalContext().addResponseCookie("Test", "Test", null);
  </code></pre>
  
  <p>Then it works well, but the cookie becomes a session cookie with max age of <code>-1</code>.</p>
  
  <p>When I try as below:</p>
  
  <pre><code>Map&lt;String, Object&gt; properties = new HashMap&lt;&gt;();
  properties.put("domain", "test");
  properties.put("maxAge", 31536000);
  properties.put("secure", false); 
  properties.put("path","/");
  FacesContext.getCurrentInstance().getExternalContext().addResponseCookie("Test", "Test", properties);
  </code></pre>
  
  <p>Then I don't see the cookie anywhere. I don't understand why.</p>
  
  <p>I'm using Tomcat 7.</p>