• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Display images on jsp from server using absolute path

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here's a sample on streaming binary data that you might find helpful.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic