Dear friends

I am new to this forum and looking for help here. I am building an application in JSP with TomCat and MySQL. The application is to be stored on C:\ on the server while the data it will be dealing with will be on D:\. When I use the file:// protocol with rest of the path in the src attribute of the image tag, it does not work and does not display the image. Now I want to know how I can set up the path for the data that I am using from D:\.

Any help will be appreciable. Thanks in advance.

Regards
Parminder Singh

Recommended Answers

All 3 Replies

Well this is not a question of JSP, since your query is related to the IMG tag of HTML,

Anyways try using the absolute path to your image file in the "src" attribute of the <img> tag, for example "D:\abc.jpeg", instead of file:///.

Well this is not a question of JSP, since your query is related to the IMG tag of HTML,

Anyways try using the absolute path to your image file in the "src" attribute of the <img> tag, for example "D:\abc.jpeg", instead of file:///.

Thanks stephens! for your quick response. but let me know how would others be able to see the image on server? i tried to do that but when i run the file from localhost and for that matter, from any server, it will not display the image.

Regards
Parminder Singh

For that you will need to place your image in one of your published folders, So either you will have to move the image in the same published folder hierarchy as the html page and use the relative path, or else you would have to publish the folder in which your image file is stored, and then you could put the HTTP link to your image, in the "src" attribute.

Right now I am only aware of these two ways, maybe some else may have a better suggestion.

Also the "file:///" attribute functions the same way as you would if you placed the "D:/.." absolute file path in the "src" attribute.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.