• 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

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.
 
Self destruct mode activated. Instructions for deactivation encoded in this tiny ad.
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic