[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

How do I display an image using a Java Servlet?

Posted on 2009-04-14
2
Medium Priority
?
323 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 750 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Verbose logging is used to diagnose garbage collector problems. By default, -verbose:gc output is written to either native_stderr.log or native_stdout.log.   It is also possible to redirect the logs to a user-specified file. This article will de…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
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.
Suggested Courses

656 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