This code works fine in Internet Explorer 5 for all versions, but is not working on IE6. When I run the page on...
an IE6 browser, it displays the HTTP header as text in the browser.
HTTP/1.1 200 OK Date: Tue, 04 Feb 2003 19:42:28 GMT Server: Apache/1.3.20 (Win32) mod_jk Pragma: No-cache Expires: Thu, 01 Jan 1970 00:00:00 GMT Cache-Control: private Set-Cookie: One=0;Path=/ Set-Cookie: Two=0;Path=/ Servlet-Engine: Tomcat Web Server/3.2.3 (JSP 1.1; Servlet 2.2; Java 1.3.1; Windows 2000 5.0 x86; java.vendor=Sun Microsystems Inc.) Keep-Alive: timeout=15, max=97 Connection: Keep-Alive Transfer-Encoding: chunked Content-Type: text/html; charset=utf-8 e05I am using cookies in my JSP pages, and I have set headers as following:
response.setHeader("Pragma", "No-cache"); response.setDateHeader("Expires", 0); response.setHeader("Cache-Control", "no-cache"); response.setHeader("Cache-Control", "private");I am setting cookies as follows:
Cookie ckiOne = new Cookie("One", java.lang.String.valueOf(m_iOne)); ckiOne.setPath("/"); response.addCookie(ckiOne); Cookie ckiTwo = new Cookie("Two", java.lang.String.valueOf(m_iTwo)); ckiTwo.setPath("/"); response.addCookie(Two);Any help in this regard would be great. I have set the browser to "Accept all cookies".
Your response is the Status-line and response header of the HTTP message that your browser received. HTTP uses text headers to pass information about request and response messages. Each header consists of a list of unordered fields containing a field name and a field value delimited by a colon and a space. The Status-Line consists of the HTTP-protocol version followed by a status code and an a status phrase. The first digit of the status code defines the response class.
Your JSP code is explicitly trying to set the HTTP headers. Since the servlet compiled from your JSP handles this automatically any attempts to manually set them could result in them being handled as page content.
Try removing the "setHeader" lines from your code.
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.