Forums Register Login

Firefox doesnt support images

+Pie Number of slices to send: Send
In my jsp I have a coding like this.

<%= 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?
+Pie Number of slices to send: Send
What is the HTML that gets generated from this, and to which absolute URL does that translate? Is there an image at that URL?
+Pie Number of slices to send: Send
I dont have the full coding right now. The path contains a actual image and it displays fine in the IE but in firefox only the image border is displayed.
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
Thanks. The image resides in the web application. How should i handle dynamically changing image paths?
[ August 06, 2007: Message edited by: Dilshan Edirisuriya ]
+Pie Number of slices to send: Send
 

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.
+Pie Number of slices to send: Send
If the images are part of your web application, then you should be able to make them relative to your web app (start path with "/")
+Pie Number of slices to send: Send
The problem is im using netbeans IDE. In netbeans environment there is a build path also same as the development environment. I have uploaded the images to the build path by getting the real path as above.Thats why i'm using the same syntax to acceess the image. Tell me the correct way of doing this.
+Pie Number of slices to send: Send
Regardless of the IDE you're using, JEE applications have a spec driven directory structure. If you want your browser to be able to view images directly (if you want to serve them up as static resources) they will need to be located in the correct place within your web application.

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.
+Pie Number of slices to send: Send
Then why does it work in Internet Explorer? Then it should not work in both browsers
+Pie Number of slices to send: Send
 

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.
+Pie Number of slices to send: Send
 

Originally posted by Dilshan Edirisuriya:
Then it should not work in both browsers


Also, when dealing with client side issues (which, service up local images is..) you can never assume that something will work the same way any two browsers.
What's that smell? Hey, sniff this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1355 times.
Similar Threads
JSF chart and Chinese font
Unable to choose tools menu in firefox 3
Change CSS from ControllBean
images not showing
min-height no work in IE
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 09:13:52.