hi everyone ,Can any one tell me how to prevent caching an image in broser .when i first user logs in the out.gif is stored in cache & second user is also getting same image . thanks in advance
The headers in the JSP control the caching of the HTML page generated by the JSP, not the caching of any images it references. You need to set those headers for the image. That may mean that you need to address images through a servlet, which streams it to the browser and can set headers at will.
Nothing you do in the JSP is going to affect the images - it will affect the caching of the HTML page.
The CodeBarn has an example of how to stream images from a servlet. I'm not sure if it sets headers, have a look at its source. You'll need to pass the name of the image as URL parameter to the servlet, so that the servlet can read the file from disk.
Originally posted by Ulf Dittmer: The CodeBarn has an example of how to stream images from a servlet. I'm not sure if it sets headers, have a look at its source. You'll need to pass the name of the image as URL parameter to the servlet, so that the servlet can read the file from disk.
It does set headers (but not no-cache headers). It's not necessary to pass the image name as a parameter. The servlet is mapped to "/images/*" and the servlet parses the image name from the URL. [ February 18, 2008: Message edited by: Ben Souther ]
Post by:autobot
Crusading Chameleon likes the size of this ad:
a bit of art, as a gift, that will fit in a stocking