I want to refresh / reload my jsp page after a certain period of time. Consider a time interval of 5 minutes.
How can this be achieved?
you can use public void setIntHeader(String header, int headerValue)
public void setIntHeader(String header, int headerValue)
response.setIntHeader("Refresh",300)
This method sends the “Update” header back to the browser along with an integer value that indicates the time interval in seconds.
You can try adding this:
<META HTTP-EQUIV="Refresh" CONTENT="10">
So, this will refresh the page every 10 seconds.
jsp add
<% response.setIntHeader("Refresh", time_in_second); //in your case 60*5=300 (for 5 min) %>
java-, Rahul Tripathi , html- jsp.
Rahul Tripathi
javascript :
<script type="text/javascript"> setTimeout(function(){ location = '' },60*1000) </script>
setTimeout will reload the page after a certain number of milliseconds, therefore 60 * 1000 = 1 m.
setTimeout