Solved

How do I display an image using a Java Servlet?

Posted on 2009-04-14
2
314 Views
Last Modified: 2013-12-02
When I try to return an image in a servlet.java file using:
out.println("<img src="+ layer + "/");
I can see that the correct size of the images is being sent to the page but the image does not appear. I'm using a BufferedImage:
BufferedImage layer = ImageIO.read(new File("/documents/images/test.png"));
What am I doing wrong?
0
Comment
Question by:DG1212
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 92

Accepted Solution

by:
objects earned 250 total points
ID: 24143841
your servlet needs to return the contents of the image. You use a img tag to *call* your servlet

http://www.exampledepot.com/egs/javax.servlet/GetImage.html

0
 

Author Closing Comment

by:DG1212
ID: 31570176
Of course. Thank you.
0

Featured Post

More Than Just A Video Library

Train for your certification. Learn the latest DevOps tools. Grow your skillset to do better work.

At Linux Academy, we release new training modules every week so you'll always be up to date on the latest tech.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This exercise is about for the following scenario: Dmgr and One node with 2 application server. Each application server contains it owns application. Application server name as follows server1 contains app1 server2 contains app1 Prereq…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question