Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6939491
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:37:45+00:00 2026-05-27T12:37:45+00:00

I’m working on an application and where I need to refer my application images

  • 0

I’m working on an application and where I need to refer my application images and other things like js etc.
now in my JSP files when I’m trying to load images using this path

<img src="static/media/images/logo.gif" alt="welcome" />

I saw the following error in the browser: unable to load the image

I even tried to refer the absolute path

<img src="/static/media/images/logo.gif" alt="welcome" />

but still no luck at all. Finally when I appended my project name it started working. E.g if my web-application name is abc I used following thing

<img src="/abc/static/media/images/logo.gif" alt="welcome to donateblood.com" />

but that I’m sure not the right way to refer the images as this means change in web-application name will lead me to change each and every URL of image which is not feasible at all.
The images which has been mentioned inside the css file are working perfectly fine.
can anyone guide me the proper way to refer the images.

Additional information:
I’m using eclipse as my IDE and Tomcat as the container along with it is a Java EE standard web-application

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T12:37:46+00:00Added an answer on May 27, 2026 at 12:37 pm
    static/media/images/logo.gif
    

    is a relative path. If you’re on the page http://localhost/myWebApp/foo/bar.html, it will resolve to

    http://localhost/myWebApp/foo/static/media/images/logo.gif
    

    /static/media/images/logo.gif
    

    is a path which is absolute to the web server.Wherever you are, it resolves to

    http://localhost/static/media/images/logo.gif
    

    You thus need to prepend the web app’s context path to the absolute path. Use

    <img src="${pageContext.request.contextPath}/static/media/images/logo.gif" alt="welcome" />
    

    or

    <img src="<c:url value='/static/media/images/logo.gif'/>" alt="welcome" />
    

    as you should do for all the URLs in the webapp.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to render a haml file in a javascript response like so:
I have thousands of HTML files to process using Groovy/Java and I need to
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace
In my XML file chapters tag has more chapter tag.i need to display chapters

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.