title: Can't set a cookie with JSP
body: <p>Can't set a cookie through JSP. But JavaScript works good.</p>
  
  <pre><code>&lt;%@ page contentType="text/html;charset=UTF-8" language="java" %&gt;
  ...//imports and taglibs
  &lt;%@ page import="javax.servlet.http.Cookie" %&gt;
  &lt;%
      Cookie cookie = new Cookie("testJSP", "testJSP");
      cookie.setMaxAge(365*24*60*60);
      response.addCookie(cookie);
  %&gt;
  &lt;div ...
     &lt;span&gt;&lt;%=request.getCookies()[0].getName() + " " + request.getCookies()[1].getName()%&gt;&lt;/span&gt;
  </code></pre>
  
  <p>I will get a JSESSIOID and a name "test" of my cookie that I set through JS, but if I try to add</p>
  
  <pre><code>request.getCookies()[2].getName()
  </code></pre>
  
  <p>I'll get an "HTTP Status 500 - An exception occurred processing JSP page /WEB-INF/jsp/issueGrid.jsp at line 18"
  Also in Firebug I don't see cookie that I set from JSP.
  Can you help me? Where is my problem?
  Thx!</p>