You need to do this differently. Serve one HTML page that includes
<img src="ServletX?id=xxxx"> tags for your X pictures. The src url for
the pictures then points to a servlet that take the URL parameter of
the picture ID, load the data and write it to the stream.

Servlet code also needs to set the content type to "image/jpg" or
whatever your binary format is:

response.setContentType(pic.getMimeType());
response.getOutputStream().write(pic.getImage().getBytes());




On Dec 16, 12:18 pm, Yiming Li <[email protected]> wrote:
> Hi all,
>         I am testing the Image Api, what I am trying to do is to
> display the following on the page:
>         picture name1
>         picture1
>         picture name2
>         picture2
>         .......
>
>         the code is:
>         public void doGet(HttpServletRequest req, HttpServletResponse resp)
>                         throws IOException {
>               try {
>                         resp.getOutputStream().print("picture name12");
>                         resp.getOutputStream().write(picture1.getImageData());
>                         resp.getOutputStream().flush();
>
>                         resp.getOutputStream().print("picture name2");
>                         resp.getOutputStream().write(picture2.getImageData());
>                         resp.getOutputStream().flush();
>
>                         ...
>                 } catch (IOException e) {
>                         e.printStackTrace();
>                 }
>         }
>
>          I know there is something wrong in this code, because when I
> execute it, the web browser download a page which contains the string
> "picture1" and the raw data of picture1...
>          Any help is greatly appreciated!
>
> Yiming

--

You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.


Reply via email to