Try closing the writer
out.close();
R.U. Spell wrote:
I am having trouble with a servlet in Netscape v 4.76.
I am running Red Hat Linux 7.2. Thus far I have had
no luck in finding a solution in the archives or
elsewhere.
The servlet (code included below) calls another class
that generates a JPG and outputs it to a file. A link
to the temporary image file is supposed to be
displayed on the page, but instead I get a pop-up
displaying "The document contains no data".
I have verified that the servlet is generating the
image and placing it in my /tmp folder. I have also
tested it by outputting the image to
$CATALINA_HOME/temp.
Any assistance that you can provide would be greatly
appreciated!!
CODE...
import java.io.*;
import java.text.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import duke.cgt.bard.apps.SimpleBardApplication;
public class BARD extends HttpServlet {
static final String PATH =
"/home/www/pkg/jakarta-tomcat-4.0.6/temp/";
static String datafile;
public void doBard(String file) {
String[] temp = new String[6];
temp[0] = "-d";
temp[1] = file;
temp[2] = "-type";
temp[3] = "ie";
temp[4] = "-o";
temp[5] = PATH+"bard.jpg";
try {
SimpleBardApplication.main(temp);
}catch(Exception e) {
e.printStackTrace();
}
}
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException
{
datafile = request.getParameter("datafile");
datafile = PATH + datafile;
PrintWriter out = response.getWriter();
response.setContentType("text/html");
response.setHeader("pragma", "no-cache");
out.println("html");
out.println("body");
out.println("head");
out.println("titleBARD Demo/title");
out.println("/head");
out.println("body bgcolor=\"white\"");
out.println("H1BARD Demo/H1");
out.println("This is the image file " +datafile);
out.println("/body");
out.println("/html");
this.doBard(datafile);
}
public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException
{
doGet(request, response);
}
}
Thanks
Rus
__
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com
---------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Athoa Signature
Mark
Riddoch - Software Architect
ATHOA
Ltd. Making
CRM a reality
WeirBank
Phone:
+44 (0)1628 762
635
Bray-on-Thames
Fax:
+44 (0)1628 635
985
Maidenhead -
SL62ED
Mobile:
+44 (0)7850 218
966
UK
e-mail:
[EMAIL PROTECTED]
inline: ATHOA Logo - eMail.gif