wood burning stoves 2.0*
The moose likes JSP and the fly likes Display images on jsp from server using absolute path Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Display images on jsp from server using absolute path" Watch "Display images on jsp from server using absolute path" New topic
Author

Display images on jsp from server using absolute path

swati aole
Greenhorn

Joined: May 02, 2009
Posts: 9
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

Joined: Mar 22, 2000
Posts: 12769
    
    5
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

Joined: Jan 10, 2002
Posts: 61092
    
  66

Here's a sample on streaming binary data that you might find helpful.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Display images on jsp from server using absolute path