One things that will help a lot is if you please be sure to use code tags when posting code to the forums. Unformatted or unindented code is extremely hard to read and many people that might be able to help you will just move along to posts that are easier to read. Please click this link ⇒ UseCodeTags ⇐ for more information.
Properly indented and formatted code greatly increases the probability that your question will get quicker, better answers.
It looks like you wisely are constructing the URL using server-relative addressing starting with the context path (good job ). That's usually one of the major causes of problems like these, but not in this case.
What I would do next os to cut and paster the generated URL (do a View Source in the browser to see the generated HTML), and paste that URL into the browser address field. Does the image show up? If not, then you know your JSP is not the issue, but the servlet that serves up the image (the one mapped to /getImage).
It didn't show the image. Could you please suggest me, where am i going wrong in my servlet?
I tried the same servlet to test in another application, it worked.
Please suggest , What's going wrong in my code?
Paul Clapham wrote:So you are generating a URL which doesn't point to an image, right? What you should do next is to figure out what URL you need instead. That would be the URL which points to the image you expected. Then change your code to generate that URL instead.
As you might have seen my code, the mapped servlet is being invoked.. it prints the console messages which i wrote in the DisplayImgServlet.
Now what is the correction you want me to do?