[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

automatic refresh of a jsp page

Posted on 2002-06-03
4
Medium Priority
?
655 Views
Last Modified: 2009-12-16
hi all,
I have a problem regarding refreshing a jsp page. The first time I call the jsp file, the data from the database is displayed correctly. But when I update the DB, and call the jsp page, the data displayed in the browser is not updated. I still have to press "ctrl-r" to update the display. How would I update the display in the browser without using "ctrl-r"?

thanks.
0
Comment
Question by:eaglesview
[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 Comments
 
LVL 4

Accepted Solution

by:
pellep earned 600 total points
ID: 7050899
put these HTML statements on top of your page (ie inside the <head> section)

<HEAD>
<META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="cache-control" CONTENT="no-cache">
</HEAD>
0
 
LVL 19

Expert Comment

by:cheekycj
ID: 7051220
Actually, the best thing that works in IE and Netscape is to have the following:
<%
response.addHeader("Pragma" , "No-cache") ;
response.addHeader("Cache-Control, "no-cache") ;
response.addDateHeader("Expires", 0);  
%>

BOTH in the head of the of page and bottom of the page (I read this in a message board and it seems
to work for me)

<html>
<head>
<%
// this prevents caching in NS and IE
response.addHeader("Pragma" , "No-cache") ;
response.addHeader("Cache-Control, "no-cache") ;
response.addDateHeader("Expires", 0);  
%>
<!-- this will refresh the page every 5 seconds -->
<META HTTP-EQUIV=Refresh CONTENT="5; URL=currentJSP.jsp"/>
</head>
<body>

....

</body>
<%
// this helps prevent caching in IE
response.addHeader("Pragma" , "No-cache") ;
response.addHeader("Cache-Control, "no-cache") ;
response.addDateHeader("Expires", 0);  
%>
</html>

Also what you can do is add a random number at the end of the URL when you do the meta refresh.

HTH,
CJ
0
 
LVL 1

Expert Comment

by:raid999
ID: 7052255
you can also set a timer in the JSP page and then use response.redirect(URL);
0
 

Author Comment

by:eaglesview
ID: 7052674
thanks.. it solved my problem.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

While there are many new features for iOS 11, these are the five that can improve your digital lifestyle.
With so many activities to perform, Exchange administrators are always busy in organizations. If everything, including Exchange Servers, Outlook clients, and Office 365 accounts work without any issues, they can sit and relax. But unfortunately, it…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

656 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