progress bar

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rmantravadi
    New Member
    • Dec 2007
    • 1

    progress bar

    Hi,
    here is the situation: I have an "export to excel button" on click of which i open a window that calls a servlet in an iframe tag.
    in the javascript part, i have a method that creates a progress bar, and runs untill some value in session is made true..

    The problem is, the session value is not changing as i am not refreshing my page.. :P..

    can somebody suggest a way to develop a progress bar while the servlet generates the excel and renders it to the client??see my jsp code below

    [HTML]<script type="text/javascript">
    function progress()
    {
    var flg='<%=session .getValue("flag ")%>';
    var t;
    if(flg == null)
    {
    alert("inside if");
    intWidth = parseInt(docume nt.getElementBy Id("statusBar") .style.width) + 1;
    if(intWidth <= 400){
    document.getEle mentById("statu sBar").style.wi dth = intWidth+"px";
    }else{
    document.getEle mentById("statu sBar").style.wi dth = 0;
    }
    t=setTimeout("p rogress()",1000 );
    }
    else if(flg=="stop")
    {
    alert("inside else");
    alert(document. getElementById( "message1").val ue);
    alert(document. getElementById( "message2").val ue);
    document.getEle mentById("messa ge1").value = 'Finished...';
    document.getEle mentById("messa ge2").value = '';
    clearTimeout(t) ;
    <%session.remov eAttribute("fla g");%>
    }
    }
    </script>

    </head>
    <body>

    <div id="displayed" >

    </div>
    <br/>
    <div id="hidden" style="display: none;">
    <p id="message1" style="font-size: 15pt; font-family: sans-serif; color:#fd6700; background:#fff ;">
    Loading...
    </p>
    <br/>

    <div id="statusBar" style="
    margin:0px;
    padding: 0px;
    width:0px;
    height:10px;
    background-color:#fd6700;
    margin-top:0px;
    text-align: left;
    font-size: 0pt;"
    ></div>

    <p id="message2">P lease wait..Report is being generated</p>

    </div>
    </div>

    </body>


    <script>
    document.getEle mentById('hidde n').style.displ ay='';
    document.getEle mentById('displ ayed').style.di splay='none';
    progress();

    </script>

    <iframe src='<%=request .getContextPath ()%>/com/tesco/sss/pns/reports/action/ReportLoadActio n'/>[/HTML]
    Last edited by acoder; Dec 17 '07, 12:01 PM. Reason: Added code tags
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    You could use the iframe to set the value. When it's loaded, you can stop the progress bar.

    Comment

    Working...