How to refresh jsp page after given time (or interval)?

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?

+4
source share
4 answers

you can use 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.

+5
source

You can try adding this:

<META HTTP-EQUIV="Refresh" CONTENT="10">

So, this will refresh the page every 10 seconds.

+7
source

jsp add

<%
  response.setIntHeader("Refresh", time_in_second); //in your case 60*5=300 (for 5 min)
%>

java-, Rahul Tripathi , html- jsp.

+1

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.

0
source

All Articles