Hi,
I am having problems setting cookies from within JSP includes.
Two files are shown below that illustrate the problem. When I run
main.jsp, the first line DOES set the cookie "C1" with a value
of "V1". The second line calls "include.jsp", which should set the
cookie "C2" to a value of "V2", but that never happens. Testing with
more elaborate versions of the files proves that the include is
running, but the cookie never gets set.
-- BEGIN main.jsp --
<% response.addCookie(new Cookie("C1", "V1")); %>
<jsp:include page="include.jsp" flush="false"/>
-- END main.jsp --
-- BEGIN include.jsp --
<% response.addCookie(new Cookie("C2", "V2")); %>
-- END include.jsp --
My understanding of the way cookies work is that they must be sent to
the client before any other data. So my best guess of what is going
on is that JRUN is somehow sending additional data to the client
before "include.jsp" has a chance to send the "C2" cookie.
In ASP I could empty the response buffer before sending any cookie
data, but I can't find any option to do that in JSP.
Does anyone have any ideas on how to set cookies from within an
included page? The real file I am working with has some significant
logic to it that I want to keep in the include file, so it is
important that I figure out how to do it.
I am running JRUN v3.00.3694 on Apache on Linux.
Thanks!
------------------------------------------------------------------------------
Archives: http://www.egroups.com/group/jrun-interest/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/jrun_talk
or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the
body.