Search code examples
jasperserver

How to reload a jasper report repeatedly within every one minute


I use a jasper report as my dashboard on Jasper Server 6.4.2 version.on that report, I have to display current time with live updates without reloading the report manually. I tried to schedule the report and set as output options as Overwrite Files and it's not worked.

Basically,I want to reload a report when it already opened and displayed withing every given time period repeatedly until I close the report. How can I do this?


Solution

  • Found a way by myself.

    Go to ViewReport.jsp on jasper server installation files. (When a report loads,this page executes)

    Then add below code for it.(Actually we use java script to do this.)

    <script type="text/javascript">
     var url = window.location.href; //take current tab url
     var dash = 'http://localhost:8080/jasperserver/flow.html?_flowId=viewReportFlow&_flo...';
    
     if(url == dash ){
        setTimeout(function(){
            window.location.reload(1);
        }, 5000);
     }
    </script>
    

    url is the current display report URL.

    dash is the URL that we want to refresh. otherwise all the reports will be refresh within every 5 seconds.

    5000 is time gap want to refresh.

    restart the jasper server.

    that's it..