John said:
You cannot use getOutputStream() to "see" an image. You _can_ use
getOutputStream() to make the servlet send an image to its client, which
might be your web browser. To do so you write the bytes of the image to
the OutputStream returned by the method. It will probably work better
if you set an appropriate content-type header on the response first. If
you are having problems implementing this scheme then you'll probably
need to post the code and the actual text of any error messages to get
much further assistance.
John Bollinger
(e-mail address removed)
Hi John, this is steve Burrus, and here is the requested servlet code
for this image servlet which has absolutely proven to be so very
problemmatic for me!! I just now tried to compile it, and got back the
compiler error message about the "response" being an unrecognized
symbol! NOw, what is the problem?? :
servlet!
// here is the code to examine, John Bollinger!!!
package com.theresa.heinz;
import java.io.*;
import java.awt.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class ImgServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
ServletOutputStream out = reponse.getOutputStream() ;
out.println("<html><head><title>Image Servlet</title></head>");
out.println("<body>");
out.println("<p><img
src=\"myservlets/images/tomcat-power.gif\"</img src></p>");
out.println("</html></body>");
out.close();
}
}"<<
And here is the full compiler error :
cannot find symbol
symbol : variable reponse
location: class com.theresa.heinz.ImgServlet
ServletOutputStream out = reponse.getOutputStream() ;
^
1 error"<<