<div dir="ltr"><div><span style="font-family:arial,sans-serif">Hello,</span></div><div><br></div><div><span style="font-family:arial,sans-serif">I discovered that when I am executing a print() before an
response.addCookie() the cookie is not committed to the browser.</span><br></div><div>

<p class="MsoNormal" style="margin:0cm;line-height:normal"><span lang="EN-US" style=""><font face="arial, sans-serif">However, if I am using out.print() or out.println() the problem does not
occur and the cookie gets sent to the browser.</font></span></p>

<p class="MsoNormal" style="margin:0cm;line-height:normal"><span lang="EN-US" style=""><font face="arial, sans-serif"> </font></span></p>

<p class="MsoNormal" style="margin:0cm;line-height:normal"><span lang="EN-US" style=""><font face="arial, sans-serif">My Professor suggested that print() might call a flush() which commits
the response object and thus prevents the later response object from being committed.</font></span></p>

<p class="MsoNormal" style="margin:0cm;line-height:normal"><span lang="EN-US" style=""><font face="arial, sans-serif" style=""><a href="https://docs.oracle.com/javaee/7/api/javax/servlet/ServletResponse.html#flushBuffer--">https://docs.oracle.com/javaee/7/api/javax/servlet/ServletResponse.html#flushBuffer--</a></font></span></p><p class="MsoNormal" style="margin:0cm;line-height:normal"><span lang="EN-US" style=""><font face="arial, sans-serif" style=""><br></font></span></p><p class="MsoNormal" style="margin:0cm;line-height:normal"><span lang="EN-US" style=""><font face="arial, sans-serif" style="">Best Regards</font></span></p><p class="MsoNormal" style="margin:0cm;line-height:normal"><span lang="EN-US" style=""><font face="arial, sans-serif" style="">Simon</font></span></p></div></div>