I have a servlet that adds a cookie to the HTTP response. Like so:
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException
{
.
.
Cookie newCookie = new Cookie("USERID", "test");
newCookie.setMaxAge(5 * 24 * 60 * 60); // seconds
response.addCookie(newCookie);
.
.
}
This works great and the browser gets the cookie when I call the servlet
directly via http://webserver/servlet/LogServlet
however, when I include the servlet in a JSP page, the servlet returns the
desired HTML in the response but the cookie is not set. The JSP looks like
this:
<%@ page info="Log Test Page" %>
<html>
<body>
<jsp:include page="/servlet/LogServlet" flush="true"/>
</body>
</html>
Is this intended behaviour or a design problem/bug? If it is intended
behaviour, what is the correct way to approach this problem? I need to set a
persistent cookie on the browser.
Regards, James.
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html