• Post Reply Bookmark Topic Watch Topic
  • New Topic

Wait page in jsp  RSS feed

 
Ted Dong
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a jsp page that is creating an xml file on the server. The server has a process that takes this xml and creates a word document on the server. My jsp page basically waits to see if the word document is on the server then it will redirect the user to the word doc. While it is waiting the browser just shows a blank screen. What do I need to do to add some indicator for the user to see so that they know that the server is processing the request like a "Please wait" message.
Here is my code:
<HTML>
<HEAD>
<TITLE></TITLE>
</HEAD>
<%@ page import="java.util.Enumeration" %>
<BODY>
<%
String xmlData = request.getParameter("XMLData");
String ID = request.getParameter("ID");
String serverPath = request.getPathTranslated();
String xmlPath = serverPath.substring(0, serverPath.lastIndexOf("\\") - 3 ) + "ProposalXML" + "\\";
String proposalPath = serverPath.substring(0, serverPath.lastIndexOf("\\") - 3 ) + "Proposals" + "\\";
String xmlDataFile = xmlPath + ID + ".xml";
String xmlFileCheck = proposalPath + ID + ".xml";
String endFile = proposalPath + ID + ".end";
String absUrl = ("http://"; + request.getHeader("host") + request.getRequestURI());
String docUrl = absUrl.substring(0, absUrl.lastIndexOf("/") - 3) + "Proposals/" + ID + ".doc";
try
{
File fileCheck = new File(xmlFileCheck);
if (!fileCheck.exists())
{
FileOutputStream oStream = new FileOutputStream(xmlDataFile);
java.io.PrintWriter outstream = new PrintWriter(oStream);
outstream.print(xmlData);
outstream.flush();
outstream.close();
}
File fEnd = new File(endFile);
int counter = 0;
Thread Sleep_Obj = new Thread();
while (!(fEnd.exists()) && (counter <= 60))
{
Sleep_Obj.sleep(1000);
counter += 1;
}
if (fEnd.exists())
{
%><%response.sendRedirect(docUrl);%><%
}
else
{
%><center><font face="Arial,Verdana" size=+2>Document could not be generated, contact your local System Administrator</font></center><p><%
}
}
catch (IOException e)
{
}
%>
</BODY>
</HTML>
 
Mark Simms
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try adding:
<% response.setIntHeader("Refresh",10) %>
This should cause the browser to refresh the page every 10 seconds.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!