eaglesview
asked on
automatic refresh of a jsp page
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.
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
you can also set a timer in the JSP page and then use response.redirect(URL);
ASKER
thanks.. it solved my problem.
<%
response.addHeader("Pragma
response.addHeader("Cache-
response.addDateHeader("Ex
%>
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
response.addHeader("Cache-
response.addDateHeader("Ex
%>
<!-- 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
response.addHeader("Cache-
response.addDateHeader("Ex
%>
</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