Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Image refused to displayimage from database using java swing

 
muntago Richard
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good day experts. this code refuse to display image from the database. the error it display is shown below




the code is here



Thanks
 
Stefan Evans
Bartender
Posts: 1784
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65229
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please take the time to choose an appropriate forum for your posts. This forum is for questions on JSP. For more information, please click this link ⇒ CarefullyChooseOneForum.

This post has been moved to a more appropriate forum. (Assumes this was meant to be a Swing app.)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic