IDForums Report post Posted August 14, 2009 (edited) Hello, I have a html page which posts a parameter to JSP. This parameter is used to query against database and display results in FusionChart and also in HTML Table. This jsp page has to be refreshed once in a week. < body onload="window.setTimeout('window.location.reload()',604800000);"> I used the above onload function to achieve this. But every time the page reloads, user is prompted with a pop up saying: To display the page, Firefox must send information that will repeat any action(such as a search or order confirmation) that was performed earlier. Resend Cancel Is there anyway that I can avoid this prompt? Please find the attachment for your reference. Thanks. prompt.doc Edited August 14, 2009 by Guest Share this post Link to post Share on other sites
srividya_sharma Report post Posted August 17, 2009 Hi Are there any parameters received in the request to this JSP page? Srividya Share this post Link to post Share on other sites
IDForums Report post Posted August 17, 2009 (edited) Hi, There is one parameter from HTML page to this JSP page. How can I handle this? Here are more details: < % String centerName = request.getParameter("centerName"); % > Thanks. Edited August 17, 2009 by Guest Share this post Link to post Share on other sites
srividya_sharma Report post Posted August 17, 2009 Hi The Dialog is appearing because of this parameter. Can you avoid the use of this parameter, since you are reloading the page ? or maybe store this value somewhere. regards, Srividya Share this post Link to post Share on other sites
IDForums Report post Posted August 17, 2009 Hi, As in my first post, I am using this parameter to query DB to display results in JSP page. Here's the flow: HTMl displays a drop down for all the center names. Based on user selection, this center name is passed to JSP page which contains Fusion Chart and also HTML table. This particular center name is the basis for querying DB and displaying results. I cannot avoid this parameter. Please suggest. Share this post Link to post Share on other sites
srividya_sharma Report post Posted August 17, 2009 Hi Can you store the value in session/cookie? regards Srividya Share this post Link to post Share on other sites
IDForums Report post Posted August 17, 2009 Hello, I tried using cookies. Here is my code: < % String costCenter = request.getParameter("costcenter"); if(costCenter == null) costCenter = ""; Cookie cookie = new Cookie(costCenter, "costCenter"); cookie.setMaxAge(60*60); response.addCookie(cookie); % > < body onLoad="window.setTimeout(window.location='index.jsp?costCenter='+costCenter, 604800000);" > Let me know if this is right. Thanks. Share this post Link to post Share on other sites
srividya_sharma Report post Posted August 18, 2009 (edited) Hi Here is the code that you would need in index.jsp <% String costCenter = request.getParameter("costcenter"); //Check if the cookie is already present and use that value, if request parameter is not present. String cookieName = "costCenter"; Cookie cookies [] = request.getCookies (); Cookie centerCookie = null; if (cookies != null) { for (int i = 0; i < cookies.length; i++) { if (cookies [i].getName().equals (cookieName)) { centerCookie = cookies[i]; break; } } } if(costCenter == null) { if(centerCookie!=null) { costCenter = centerCookie.getValue(); System.out.println("centerCookie "+centerCookie.getValue()); } else { costCenter =""; } } if(!costCenter.equals("") || centerCookie==null) { //Set the cookie Cookie cookie = new Cookie("costCenter",costCenter); cookie.setMaxAge(60*60); response.addCookie(cookie); } %> <script> function reloadPage() { window.location='index.jsp'; } </script> <html> <body onload="setTimeout('reloadPage()',3000)" > This page refreshes itself without any dialog. <%= costCenter %> </body> </html> Please put a suitable timeout value. Hope this helps! Srividya Edited August 19, 2009 by Guest Share this post Link to post Share on other sites
IDForums Report post Posted August 19, 2009 Hi srividya, Thanks for your help. I think a recursive call is occurring somewhere. My page is refreshing continuously in a loop even though I am taking care of the time out interval. Thanks. Share this post Link to post Share on other sites
srividya_sharma Report post Posted August 19, 2009 Hi Please use the following code in the body tag: <body onload="timer=setTimeout('reloadPage()',604800000)" > and the reloadPage as defined below: function reloadPage() { window.location='index.jsp'; } Srividya Share this post Link to post Share on other sites