Re: Debugging The document contains no data error

2003-07-08 Thread Mark Riddoch




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

Sharing a session between multiple frames

2003-07-01 Thread Mark Riddoch
I have a webapp that makes use of the session to store a key to track 
the current state of a user. This all works fine under Tomcat 4.0 but 
when I move to 4.1 on Linux I get a problem as soon as I start invoking 
multiple frames on a page. It seems that a different thread is used for 
the two frames on my page, and that the new thread that gets invoked 
doesn't have the session object any more. Does anybody know of a way to 
change the configuration of  Tomcat 4.1 so that I share the session 
between the two frames?

Thanks
Mark.




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]