• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Wait page in jsp

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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>
 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
try adding:
<% response.setIntHeader("Refresh",10) %>
This should cause the browser to refresh the page every 10 seconds.
 
I carry this gun in case a vending machine doesn't give me my fritos. This gun and this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic