Hi All,

I am creating an application in which I want to keep refreshing a jsp file and in that jsp file i need to keep calling another url of type www.daniweb.com/receive.jsp?a=xxx&b=xxx and save this url in database. Here the url keeps changing in every second ie. values of a & b keeps changing.

I have been able to keep refreshing the jsp file but unable to call another dynamic url in it. Please tell me how to do it in my jsp.

Thanks in advance for your help.


You can do this one of two ways.

On each cycle :-

  1. compose the next page's URL in JSP and insert into a META REFRESH (Google search if you don't know what it is)
  2. compose the next page's URL and go to it after 1 second (1000 milliseconds)in javascript :
    onload = function() {
      var a = ......;//here write the rules for generating a
      var b = ......;//here write the rules for generating b
      setTimeout( function(){
        location.search = 'a=' + a + '&b=' + b;
      }, 1000 );

Please note: As written, the code won't give a 1 second cycle time. Rather, the page will reload 1 second after it has completely loaded, which is more likey what you want, though I must say it's a rather odd sort of application. I hope it's nothing sinister.