Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-25-2008, 01:45 AM
Member
 
Join Date: Mar 2008
Posts: 1
mnsse is on a distinguished road
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
Code:
PageBuilder.class.getClassLoader().getResource("/");
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.
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
Code:
c:\myWebApp\custom\theme\images\image1.gif
And this is what I think Firefox doesnt like, an absolute path.
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?
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
i need an example of JSR179 ((Location based Ser)implementation for CDC based device talk_to_vivekmishra CDC and Personal Profile 1 06-22-2008 10:45 PM
How to display Tabuler Data in J2EE application on jsp page AMATYA-CHANAKYA Advanced Java 2 04-23-2008 06:54 PM
(Location based Service) application for Pocket PC talk_to_vivekmishra CLDC and MIDP 0 08-14-2007 09:23 AM
Help using images in Java toby Advanced Java 1 08-07-2007 06:54 AM
Location Based Application pablodaroucchi Java Books / Tutorials / Tips 1 04-21-2007 11:59 PM


All times are GMT +3. The time now is 03:16 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org