----------------------------------------------------------------
BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
WHEN YOU POST, include all relevant version numbers, log files,
and configuration files.  Don't make us guess your problem!!!
----------------------------------------------------------------

Ivan

Please bear with me as I haven't started programming in Java yet, I have
only just installed Apache and Jsserv.  I have only been running the
supplied example Servlets (Hello.java) to test whether JServ is running OK.

So from what you are saying it would appear that returning a length of 0 is
the problem.  Do you flush the output stream by calling the close function
on it?  If so doesn't the following code do that?

This is example code I am running:

import java.io.*;

import javax.servlet.*;
import javax.servlet.http.*;


/**
 * This is a simple example of an HTTP Servlet.  It responds to the GET
 * and HEAD methods of the HTTP protocol.
 */
public class Hello extends HttpServlet
{ 
    /**
     * Handle the GET and HEAD methods by building a simple web page.
     * HEAD is just like GET, except that the server returns only the
     * headers (including content length) not the body we write.
     */
    public void doGet (HttpServletRequest request,
                       HttpServletResponse response) 
        throws ServletException, IOException
        {
            PrintWriter out;
            String title = "Example Apache JServ Servlet";

            // set content type and other response header fields first
            response.setContentType("text/html");

            // then write the data of the response
            out = response.getWriter();
            
            out.println("<HTML><HEAD><TITLE>");
            out.println(title);
            out.println("</TITLE></HEAD><BODY bgcolor=\"#FFFFFF\">");
            out.println("<H1>" + title + "</H1>");
            out.println("<H2> Congratulations, ApacheJServ 1.1b3 is working!<br>");
            out.println("</BODY></HTML>");
            out.close();
        }
}
 



> >> SC> I am having an intermittent problem running servlets.  Whenever I run
> SC> a
> >> SC> servlet for the first few attempts a message "This document contains
> SC> no
> >> SC> data" is returned.  Eventually, the servlet
s may run, and after it has
> SC> begun
> >> SC> to run it will probably run everytime from then on.
> >>
> >> SC> I presume the reason that I am getting this message is because the
> SC> servlet
> >> SC> is not getting a http servlet response because this is used to
output
> SC> the
> >> SC> HTML.
> >>
> >> SC> Can anyone help me in trying to track down why this happening?
> >>
> >> SC> Configuration is SCO Openserver 5.0.5, Apache 1.3.9 and JServ
1.1b3.
> >>
> >> SC> Thanks
> >>
> >> SC> Shaun Campbell
> >>
> >>
> >>
>
>
>
>
> SC> --
> SC> --------------------------------------------------------------
> SC> Please read the FAQ! <http://java.apache.org/faq/>
> SC> To subscribe:        [EMAIL PROTECTED]
> SC> To unsubscribe:      [EMAIL PROTECTED]
> SC> Archives and Other:  <http://java.apache.org/main/mail.html>
> SC> Problems?:           [EMAIL PROTECTED]
>
>
>
>
> --
> Best regards,
>  Ivan                            mailto:[EMAIL PROTECTED]
>
>
>
>
> --
> --------------------------------------------------------------
> Please read the FAQ! <http://java.apache.org/faq/>
> To subscribe:        [EMAIL PROTECTED]
> To unsubscribe:      [EMAIL PROTECTED]
> Archives and Other:  <http://java.apache.org/main/mail.html>
> Problems?:           [EMAIL PROTECTED]
>
>



--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html>
Problems?:           [EMAIL PROTECTED]

Reply via email to