When you display Excel documents using
Internet Explorer, you receive an error message. The problem is that to
display the document, Excel requires that the document first be cached in
Internet Explorer. If the response includes a no-cache header, Internet
Explorer does not cache the document, and
Excel fails to display the content.
You receive these Microsoft Excel errors:

This behavior also occurs if you set the browser to
not to cache a cookie.
Cache-Control: no-cache="set-cookie,set-cookie2" .
The setting of this no-cache header is recommended, as
per RFC2965, whenever a cookie is set.
The URL for RFC2965 is in the Related
information section below.
This no-cache header is set by the Web container
whenever a cookie is set using the addCookie() method. Application code
can use the addCookie() method and then the Web container will drive it
when setting the cookie in the case where a HttpSession is obtained by the
application.
There are two ways to circumvent this problem:
- Include the following statement after your
getSession() and addCookie() methods, because both of these methods set
the no-cache value in the Cache-Control header.
esp.setHeader("Cache-Control", "");
or
- Change your addCookie() to an addHeader(). The
addHeader() method does not set the no-cache value. Our experience
indicates you should call addHeader() for each cookie. For example:
resp.addHeader ("Set-Cookie","abcdef=123456789");
resp.addHeader("Set-Cooke","Domain=.ibm.com"
|