This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
In your servlet you need to change the mime type to the proper type for your image. For example, for a PNG you would use:
where response is a javax.servlet.http.HttpServlteResponse (one of the parameters to doPost(), doGet() etc.)
You can find a partial list of mime types in ./server/default/deployers/jbossweb.deployer/web.xml (AS 5.1.0 location)