You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Hubert Gailly <hg...@ereline.fr> on 2000/07/23 15:14:22 UTC

Servlet buffering

Hello , 

I am new on this list and I hope that this is the right place for the question I want to ask

I am currently a Servlet and I would like to display the result in the browser line by line.
my problem is that <HttpServletResponse>.setBufferSize(0);  and/or 
<HttpServletResponse>.flushBuffer(); do not seem to work and that the browser receive the page by packet of more or less 1Kb

Can anybody tell me what I am doing wrong or what I am missing?
 

Thanks in advance,

Hubert
            
This is some code /

  public void doPost(HttpServletRequest req, HttpServletResponse res)
                                throws ServletException, IOException 
{
    res.setContentType("text/html");
    res.setBufferSize(0);  // CHANGE NOTHING
    PrintWriter out = res.getWriter();

    try 
    {
        out.println("<HTML><BODY>"); 
          boolean isOK = true;
            while (isOK )
             {
                // Some treatment here

                  out.println("IMPORT - Fiche No ....");
                  res.flushBuffer();// CHANGE NOTHING

                 if (...)
                   isOK  = false;    
             }

      }
    }
    catch (Exception e) {
          out.println("<PRE>");
          e.printStackTrace(out);
          out.println("</PRE>");
    }
    out.println("</BODY></HTML>");
  }

ERELINE (groupe Quantix), 20 rue de Madrid, 75008 Paris, 01 45 22 06 06
Hubert Gailly (hgailly@Ereline.fr) Phone: 04 66 03 18 58
- Les solutions e-marketing




RE: Tomcat3.1 & jdk1.3?

Posted by "Rob S." <rs...@home.com>.
Hi Joseph,

I've never seen this particular error before, but it looks similar to when
you're trying to run a Java program from the command-line and its not in
your CLASSPATH.  Like if you're trying to run something with a main() that's
in a package, but that package isn't in your CLASSPATH.

Are you using the startup bat file?

I would double-check your CLASSPATH for typos or a missing semicolon or
something.  Here's my CLASSPATH from an old nightly build of Tomcat 3.2:

.:/users/tomcat/lib/ant.jar:/users/tomcat/lib/jasper.jar:/users/tomcat/lib/j
axp.jar:/users/tomcat/lib/parser.jar:/users/tomcat/lib/servlet.jar:/users/to
mcat/lib/test:/users/tomcat/lib/webserver.jar:/usr/local/jdk1.2.2/lib/tools.
jar:/usr/local/jdk1.2.2/lib/postgresql.jar:.

HTH!

- r

> -----Original Message-----
> From: Joseph Polanik [mailto:jpolanik@mindspring.com]
> Sent: July 23, 2000 8:29 AM
> To: tomcat-user@jakarta.apache.org
> Subject: Tomcat3.1 & jdk1.3?
>
>
> When I start Tomcat3.1 (using Win98 & Sun's jdk1.3) I get this error:
>
> Exception in thread "main" java.lang.NoClassDefFoundError
> C:\JavaPackages\jakarta-tomcat
>
> I've got the webserver, jasper, servlet and xml .jar files in my
> classpath as well as Tomcat_home and Tomcat_home\classes.
>
> Any suggestions?
>
>
> *****************************************************
> Joseph Polanik, jpolanik@mindspring.com
> Trionic Research Institute, http://www.trionica.com
>


Tomcat3.1 & jdk1.3?

Posted by Joseph Polanik <jp...@mindspring.com>.
When I start Tomcat3.1 (using Win98 & Sun's jdk1.3) I get this error: 

Exception in thread "main" java.lang.NoClassDefFoundError C:\JavaPackages\jakarta-tomcat

I've got the webserver, jasper, servlet and xml .jar files in my classpath as well as Tomcat_home and Tomcat_home\classes.

Any suggestions?


*****************************************************
Joseph Polanik, jpolanik@mindspring.com
Trionic Research Institute, http://www.trionica.com

Re: Servlet buffering

Posted by Hubert Gailly <hg...@ereline.fr>.
Thanks for your answer but I tried out.flush() and I am aware of the table
closing tag ( I am not using a table).

----- Original Message -----
From: ALEXANDROS KOTSIRAS
To: tomcat-user@jakarta.apache.org
Sent: Sunday, July 23, 2000 10:25 PM
Subject: Re: Servlet buffering


Probably this is not the answer to your question but why don't you also try
:
out.flush()
Also in case you are using tables and format all the output in a big table
keep in mind that the browser cannot display the HTML output unless it
reaches the
</TABLE> cloasing tag.
----- Original Message -----
From: Hubert Gailly
To: tomcat-user@jakarta.apache.org
Sent: Sunday, July 23, 2000 9:14 AM
Subject: Servlet buffering


Hello ,

I am new on this list and I hope that this is the right place for the
question I want to ask

I am currently a Servlet and I would like to display the result in the
browser line by line.
my problem is that <HttpServletResponse>.setBufferSize(0);  and/or
<HttpServletResponse>.flushBuffer(); do not seem to work and that the
browser receive the page by packet of more or less 1Kb

Can anybody tell me what I am doing wrong or what I am missing?


Thanks in advance,

Hubert

This is some code /

  public void doPost(HttpServletRequest req, HttpServletResponse res)
                                throws ServletException, IOException
{
    res.setContentType("text/html");
    res.setBufferSize(0);  // CHANGE NOTHING
    PrintWriter out = res.getWriter();

    try
    {
       out.println("<HTML><BODY>");
          boolean isOK = true;
            while (isOK )
             {
                // Some treatment here

                  out.println("IMPORT - Fiche No ....");
                  res.flushBuffer();// CHANGE NOTHING

                 if (...)
                   isOK  = false;
             }

      }
    }
    catch (Exception e) {
          out.println("<PRE>");
          e.printStackTrace(out);
          out.println("</PRE>");
    }
    out.println("</BODY></HTML>");
  }

ERELINE (groupe Quantix), 20 rue de Madrid, 75008 Paris, 01 45 22 06 06
Hubert Gailly (hgailly@Ereline.fr) Phone: 04 66 03 18 58
- Les solutions e-marketing





Re: Servlet buffering

Posted by ALEXANDROS KOTSIRAS <AL...@prodigy.net>.
Probably this is not the answer to your question but why don't you also try : 
out.flush() 
Also in case you are using tables and format all the output in a big table keep in mind that the browser cannot display the HTML output unless it reaches the 
</TABLE> cloasing tag. 
  ----- Original Message ----- 
  From: Hubert Gailly 
  To: tomcat-user@jakarta.apache.org 
  Sent: Sunday, July 23, 2000 9:14 AM
  Subject: Servlet buffering


  Hello , 

  I am new on this list and I hope that this is the right place for the question I want to ask

  I am currently a Servlet and I would like to display the result in the browser line by line.
  my problem is that <HttpServletResponse>.setBufferSize(0);  and/or 
  <HttpServletResponse>.flushBuffer(); do not seem to work and that the browser receive the page by packet of more or less 1Kb
   
  Can anybody tell me what I am doing wrong or what I am missing?
   
   
  Thanks in advance,
   
  Hubert
              
  This is some code /

    public void doPost(HttpServletRequest req, HttpServletResponse res)
                                  throws ServletException, IOException 
  {
      res.setContentType("text/html");
      res.setBufferSize(0);  // CHANGE NOTHING
      PrintWriter out = res.getWriter();

      try 
      {
         out.println("<HTML><BODY>"); 
            boolean isOK = true;
              while (isOK )
               {
                  // Some treatment here

                    out.println("IMPORT - Fiche No ....");
                    res.flushBuffer();// CHANGE NOTHING

                   if (...)
                     isOK  = false;    
               }

        }
      }
      catch (Exception e) {
            out.println("<PRE>");
            e.printStackTrace(out);
            out.println("</PRE>");
      }
      out.println("</BODY></HTML>");
    }

  ERELINE (groupe Quantix), 20 rue de Madrid, 75008 Paris, 01 45 22 06 06
  Hubert Gailly (hgailly@Ereline.fr) Phone: 04 66 03 18 58
  - Les solutions e-marketing