-----------------------------
Please read the FAQ!
<http://java.apache.org/faq/>
-----------------------------

Write another servlet that you call from the <img> tag which loads the image and sends 
an image/jpeg (or whatever mime type) response. Should work, but I haven't tried it. 
Let me know if you try it, I was planning on making a servlet like this at some point 
in the future.

-Greg


---------- Original Message ----------------------------------
From: "Durga Panda" <[EMAIL PROTECTED]>
Reply-To: "Java Apache Users" <[EMAIL PROTECTED]>
Date: Tue, 05 Oct 1999 10:34:27 PDT

>-----------------------------
Please read the FAQ!
<http://java.apache.org/faq/>
-----------------------------

please se the code below:
if i want to have a byte[] dirctly displayed on html; how do i do it??

import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class tryMe extends HttpServlet {
  public void service(HttpServletRequest req, HttpServletResponse res)
                               throws ServletException, IOException {
    res.setContentType("text/html");
    PrintWriter out = res.getWriter();

    out.println("<HEAD><TITLE>Try now</TITLE></HEAD>");
    out.println("<BODY> It is working");

    //to show a pic which is hyper link to a file  (this will work)
    out.println("<IMG SRC=\"/mcpd/servlets/chaseblue.gif\" WIDTH=140 
HEIGHT=43 BORDER=0> ");

    //********
    //to show a 3439 bytes  pic from a byte[] (i did as below;but it does 
not work)
    //********
    File fl = new File("c:\\tryme\\chaseblue.gif");
    byte[] pic = new byte[(int)fl.length()];
    out.println("<IMG SRC=" ) ;
    out.println( pic );
    out.println(" WIDTH=140 HEIGHT=43 BORDER=0> ");

    out.println("</BODY></HTML>");
    out.close();
  }
}

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com


--
--------------------------------------------------------------
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