You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "David M. Rosner" <da...@recommend-it.com> on 2001/04/12 20:40:48 UTC

Weird Cookie Behavior

Hi All,

I have a jsp that sets a cookie named 'riCookie'. For some reason this 
cookie will not be sent to the browser unless I set an additional cookie 
after that. Here is the code:

This doesn't work:

<%
     response.addCookie( new Cookie("riCookie", "DATA" ) ) ;
     response.sendRedirect( "/someOtherPage.jsp" );
%>

But this does work:
<%
     response.addCookie( new Cookie("riCookie", "DATA" ) ) ;
     response.addCookie( new Cookie("Something", "More DATA" ) ) ;
     response.sendRedirect( "/someOtherPage.jsp" );
%>

Any idea why? I tried other names with the word 'Cookie' in them and they 
seem to work as well.

Thanks for any help,

-dave