a question about Jsp

do these tags have to be the first thing in a jsp file (like inside head in html) to avoid caching or can i put it at the end of the file ,

<%

response.setHeader("Pragma","no-cache");

response.setHeader("Cache-Control","no-cache");

response.setHeader("Cache-Control","max-age=0");

response.setHeader("Cache-Control", "no-store");

response.setHeader("Cache-Control", "max-stale=0");

%>

thanks

[458 byte] By [dumbmastera] at [2007-11-27 2:52:13]
# 1

Put it at the beginning. You can't write a header to the response if you have already written more than X bytes of data to the response, where X isn't very big.

Or better still have a Filter do that for all of your JSPs, rather than copying the code into every single JSP you ever write.

DrClapa at 2007-7-12 3:26:09 > top of Java-index,Java Essentials,New To Java...