aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Image refused to displayimage from database using java swing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Image refused to displayimage from database using java swing " Watch "Image refused to displayimage from database using java swing " New topic
Author

Image refused to displayimage from database using java swing

muntago Richard
Ranch Hand

Joined: Nov 13, 2010
Posts: 82
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

Joined: Jul 06, 2005
Posts: 1018
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

Joined: Jan 10, 2002
Posts: 61648
    
  67

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.)


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Image refused to displayimage from database using java swing