?
Solved

how can i use jstl code to clear ie cache???

Posted on 2005-03-03
7
Medium Priority
?
1,910 Views
Last Modified: 2013-11-24
hi,experts,
  now i use
<%
response.setHeader("Pragma","No-cache");
response.setHeader("Cache-Control","no-cache");
response.setDateHeader("Expires", 0);
%>
to clear ie cache

i want use jstl to do it,how can i do it???

<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
?????

thanks!
0
Comment
Question by:hgbdelphi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 29

Expert Comment

by:bloodredsun
ID: 13457082
<c:out value='${pageContext.response}'/> returns an object of class org.apache.coyote.tomcat4.CoyoteResponseFacade which implements the HttpServletResponse. So you have access to all the methods you normally would to alter reponse object values.
0
 
LVL 29

Accepted Solution

by:
bloodredsun earned 200 total points
ID: 13457231
I would rather recommend including a page fragment "nocache.jsp", using c:import that just used the scriplet above so that you take it out of your code and increase re-usability as it allows you to have that code in all your pages but only have to maintain the one version.

e.g.

nocache.jsp
--------
<%
response.setHeader("Pragma","No-cache");
response.setHeader("Cache-Control","no-cache");
response.setDateHeader("Expires", 0);
%>

myPage.jsp
--------
<%@ taglib uri='http://java.sun.com/jstl/core' prefix='c' %>
<c:import  url='nocache.jsp' />
<html>
.......
0
 
LVL 29

Expert Comment

by:bloodredsun
ID: 13457252
Actually, if you go here http://www.phptr.com/articles/article.asp?p=30946&seqNum=7 (scroll down to respose properties) you cannot alter response headers via JSTL as you only have access to 4 properties: bufferSize, characterEncoding, locale, committed
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 35

Expert Comment

by:TimYates
ID: 13457396
>> nocache.jsp

This is better (covers more browser versions, and sme IE bugs of old)...

<%
    // Set to expire far in the past.
    response.setHeader("Expires", "Sat, 6 May 1995 12:00:00 GMT");

    // Set standard HTTP/1.1 no-cache headers.
    response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");

    // Set IE extended HTTP/1.1 no-cache headers (use addHeader).
    response.addHeader("Cache-Control", "post-check=0, pre-check=0");

    // Set standard HTTP/1.0 no-cache header.
    response.setHeader("Pragma", "no-cache");
%>
0
 

Author Comment

by:hgbdelphi
ID: 13463971
thanks for bloodredsun and TimYates

i use <c:import  url='nocache.jsp' /> to do it now!

to TimYates
  say sorry for not give your points.:)
0
 
LVL 29

Expert Comment

by:bloodredsun
ID: 13465182
It is possible to split points. If you are using any of TimYates' code I think it would be fair to give him some points. If you want to you can go the the Community Support topic area and ask for a mod to re-assign the points to give him some. What do you think Tim?
0
 
LVL 35

Expert Comment

by:TimYates
ID: 13470943
It would be nice, but this is only a 50 point question...so I'm just glad we could help :-)

hgbdelphi, for future reference, there is a "Split Points" link just above the comment box that you can use to assign points to all the different people who helped :-)

Good luck with it though :-)

Tim
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question