Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Wait page in jsp?

Status
Not open for further replies.

samvonac

Programmer
May 18, 2001
8
US
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=&quot;java.util.Enumeration&quot; %>

<BODY>

<%
String xmlData = request.getParameter(&quot;XMLData&quot;);
String ID = request.getParameter(&quot;ID&quot;);

String serverPath = request.getPathTranslated();
String xmlPath = serverPath.substring(0, serverPath.lastIndexOf(&quot;\\&quot;) - 3 ) + &quot;ProposalXML&quot; + &quot;\\&quot;;
String proposalPath = serverPath.substring(0, serverPath.lastIndexOf(&quot;\\&quot;) - 3 ) + &quot;Proposals&quot; + &quot;\\&quot;;

String xmlDataFile = xmlPath + ID + &quot;.xml&quot;;
String xmlFileCheck = proposalPath + ID + &quot;.xml&quot;;
String endFile = proposalPath + ID + &quot;.end&quot;;

String absUrl = (&quot; + request.getHeader(&quot;host&quot;) + request.getRequestURI());
String docUrl = absUrl.substring(0, absUrl.lastIndexOf(&quot;/&quot;) - 3) + &quot;Proposals/&quot; + ID + &quot;.doc&quot;;

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=&quot;Arial,Verdana&quot; size=+2>Document could not be generated, contact your local System Administrator</font></center><p><%
}

}
catch (IOException e)
{
}
%>
</BODY>
</HTML>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top