This is discussed (somewhat) in a WebReview article I did a while back. We
also covered it in Java Servlet Programming.

http://www.webreview.com/wr/pub/97/11/14/webdev/index.html

Essentially, you need to create an AWT context before using AWT calls. In a
servlet you need to do this explicitly, while in an Applet or Application
the context is pre-existing. That's why most of the sample code you see in
books won't run when dropped into a servlet.

I haven't done this in a while, but if you create a new java.awt.Frame
object, call addNotify(), you should then be able to call
getToolkit().getImage("my.gif") on the Frame without any problems.

At 06:59 AM 6/22/2000 -0700, Jim Graham wrote:
>Hi,
>I've been trying to get an image into my servlet,
>but when I try it dies when it hits the call below:
>
>Image myImage =
>Toolkit.getDefaultToolkit().getImage("my.gif");
>
>
>Any ideas on how to get an image into a servlet?
>Thanks,
>Jim
>
>
>
>__________________________________________________
>Do You Yahoo!?
>Send instant messages with Yahoo! Messenger.
>http://im.yahoo.com/
>
>___________________________________________________________________________
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff SERVLET-INTEREST".
>
>Archives: http://archives.java.sun.com/archives/servlet-interest.html
>Resources: http://java.sun.com/products/servlet/external-resources.html
>LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

---
William Crawford                                        + 01 617 577 7844
Invantage, Inc                                            [EMAIL PROTECTED]

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to