Ok, first question you need to answer: Are you writing a web application or a standalone java application?
Because you seem to have one unholy mix of the two right here.
You have written a java application using Swing components. That looks like standalone java application.
You then try and reference an HttpServletResponse (which you create out of nowhere) and send it somewhere. That looks like web application.
These things do not go together.
If you want to display an image in your java application, I would recommend you take a look at the g.drawImage() call.
If you want to display an image on a web page, then you should be writing this as a servlet, not a standalone application, and you will need an html page with an <img> tag on it.
Decide which path you want to take, and choose the appropriate forum.