<%= application.getRealPath("images")+"/"+"image1.jpg" %>.
The image appears correctly in IE but it doesnt appear in Firefox. What are the possible reasons for this. Do i need to change the code?
[ August 06, 2007: Message edited by: Dilshan Edirisuriya ]
Originally posted by Ulf Dittmer:
What does "application.getRealPath" do? Is "application" the servlet context? If so, then it can't possibly work, because ServletContext.getRealPath returns a file system path that's valid only on the server, not the browser.
It can work but only if you're running a brower on the same machine that is hosting the webserver.
There is a link to the Servlet Spec in my signature.
It is worth taking the time to read it.
Chances are, your IDE will not be present in the production environment so it is important that all the developers on your project know how to deploy and debug your app without it.
Originally posted by Dilshan Edirisuriya:
Then why does it work in Internet Explorer? Then it should not work in both browsers
Does it matter?
You're using code that serves up images as local resources; using a path that your users are almost guaranteed not to have on their local machines.
Whether it works in FF on your machine or not, I can assure you it won't work with any browser once you publish it.