since the image is not on the server that host the servlet, seems like the sandbox policy restricted me from displaying the image directly on my applet using getImage() function . So, I would like to ask for your help in preparing the servlet and applet codes for the servlet to pass the image to applet, and then the image is displayed on applet.
I am a new comer in Java programming, can you please give me the instruction as detail as possible? Thank you very much.
I've done that, some years ago. What I used was a servlet that received the url
of the image, got the image as a byte stream over the net, converted it into a gif using a gifencoder and send it back to the client.
Using the servlet was easy, it was included in the html as the target of the src
parameter on image tags.
So it did not send the image to the applet as you want, but I guess that could be
fixed as the applet could get the byte stream and to the image create itself...
Thank you very much for your help. I actually understand the logic of what to do with it, but I really don't know how to do it. It would be much helpful if you can give me the code. I desperately need your help. Thank you veyr much.
Here is an applet and a servlet, the applet gets image url as user input
and calls the servlet with the image url as the only parameter. The
applet then creates an image from the byte stream returned from the
servlet
NOTE
I have not tested this, as my server setup is not quite ok at the moment.
Update:
Uuuups ! I have tested the applet and found that i had forgotten something
important:
Ive tested it without the servlet, just writing the image url in the url entry
field, and that works. The servlet is basically doing the same thing as the
applet, except that it accesses other servers and returns the image byte
stream to the applet.
PS: the GifEncoder I mentioned is not required for plain image transfer.
Last edited by sjalle; 06-08-2005 at 09:06 AM.
Reason: deaf button
Bookmarks