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(document.getElementById("statusBar").styl e.width) + 1;
if(intWidth <= 400){
document.getElementById("statusBar").style.width = intWidth+"px";
}else{
document.getElementById("statusBar").style.width = 0;
}
t=setTimeout("progress()",1000);
}
else if(flg=="stop")
{
alert("inside else");
alert(document.getElementById("message1").value);
alert(document.getElementById("message2").value);
document.getElementById("message1").value = 'Finished...';
document.getElementById("message2").value = '';
clearTimeout(t);
<%session.removeAttribute("flag");%>
}
}
</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">Please wait..Report is being generated</p>
</div>
</div>
</body>
<script>
document.getElementById('hidden').style.display='' ;
document.getElementById('displayed').style.display ='none';
progress();
</script>
<iframe src='<%=request.getContextPath()%>/com/tesco/sss/pns/reports/action/ReportLoadAction'/>[/HTML]