• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Display images on jsp from server using absolute path

 
swati aole
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I am working on a project using jsp and AJAX. I need to display images on my jsp page according to image file name selected by user. The problem is that, I can't use relative path to retrieve images because there are thousands of images and I can't store them in some img folder and attach the same at the time of deployment in my project.

So I was using the absolute image path with "<img src>" and it was working fine, but it's not working with the enhanced browser version. When user installs the latest flash player version, images are not displayed neither the "alt text", only the empty image frame is displayed.

I am stuck here and can't find the reason. Please give suggestions for implementation of this functionality.

Thanks in advance.

Regards
Swati
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13055
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Allowing servers to serve files from absolute paths would be a huge security hole. For this reason the servlet/jsp API restricts file serving to the application relative URL path.

IF you want to serve files located somewhere else you can always use a custom servlet.

Bill
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64620
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's a sample on streaming binary data that you might find helpful.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic