Results 1 to 1 of 1
- 03-25-2008, 12:45 AM #1
Member
- Join Date
- Mar 2008
- Posts
- 6
- Rep Power
- 0
display images in a Web Application based on java/jsp
Hi,
This is my first post here and not sure if this is the right place to ask this question. Let me know if I have to repost my question elsewhere.
So here is my question:
I am currently working on a web app. It has got lots of java code, jsp file, xml etc. On one of the JSP pages I have to display some images. There is a dedicated folder storing all images and icons. I have to get some images from the dedicated image folder and display them on the JSP page. But I am trying to do this dynamically, I don't want to hardcode the images' location in the JSP or Java code. I am calling a java method
This returns me a folder which is not the Web App's root. I would prefer getting web app's root but that is not an issue at this time. The folder that above line of code returns is not where the images and icons are, so what I do in my java code is that, I move up some folders and then mode down a few folder and get to the location where images and icons are stored. Even in this I am making assumptions and this code may fail if for some reason folder hierarchy is disturbed/modified.Java Code:PageBuilder.class.getClassLoader().getResource("/");
But anyway, what I don't understand is that my images and icons get displayed in Internet Explorer but Firefox fails to show those images & icons.
Even though, I am trying not to hardcode any image path, I am unintentionally doing it. Becuase getResource("/") returns me a path something like
And this is what I think Firefox doesnt like, an absolute path.Java Code:c:\myWebApp\custom\theme\images\image1.gif
Can anyone suggest a better way of doing this? Obviously webapps will be on a server, users will be connecting to the webapp via their browsers but I guess I need to have some way of sending the image over to the users' browser. How do I do something like this?
Similar Threads
-
i need an example of JSR179 ((Location based Ser)implementation for CDC based device
By talk_to_vivekmishra in forum CDC and Personal ProfileReplies: 3Last Post: 12-30-2010, 10:07 AM -
How to display Tabuler Data in J2EE application on jsp page
By AMATYA-CHANAKYA in forum Advanced JavaReplies: 2Last Post: 04-23-2008, 05:54 PM -
(Location based Service) application for Pocket PC
By talk_to_vivekmishra in forum CLDC and MIDPReplies: 0Last Post: 08-14-2007, 08:23 AM -
Help using images in Java
By toby in forum Advanced JavaReplies: 1Last Post: 08-07-2007, 05:54 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks