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 7980231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T10:00:22+00:00 2026-06-04T10:00:22+00:00

I am using Spring MVC 3.0. I have to load the images which exist

  • 0

I am using Spring MVC 3.0.

I have to load the images which exist in the folder “images” parallel to the WEB-INFdirectory.

I have the jsp files in WEB-INF/jsp folder.

The folder structure is:

-app
--images
--WEB-INF
---jsp
---classes
...

In web.xml the url mapping for DispatcherServlet is some thing like

<servlet-mapping>
    <servlet-name>test</servlet-name>
    <url-pattern>/</url-pattern>
</servlet-mapping>

Now in JSP if I load the jsp in the following way:

<img src="<%=request.getContextPath()%>/images/calogo.jpg" />

Its now working as DispatcherServlet is intercepting it I guess.

  • 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-06-04T10:00:23+00:00Added an answer on June 4, 2026 at 10:00 am

    Yes you are right. Your dispatcher is intercepting your request to display the images.

    According to me when you try to access the image in your jsp file it will give you 404 error.

    You need to include the following line of code in your servlet.xml file.

    <mvc:resources location="/images/" mapping="/images/**" />
    

    And then everything will work.

    Hope this helps you.

    Cheers.

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

Sidebar

Related Questions

I'm trying to write a web application using Spring MVC. I have a configuration
I am using Spring MVC to build my web application, and I have a
I have to load 3 spring config xml files in myproj spring mvc app
I have a problem while returning jsp from controller using ajax+spring mvc. I want
I'm using spring MVC, and I have a custom authentication/security system that I had
I am using spring web mvc for my app's UI part.. By using following
I am using Spring 3 MVC and MySQL 5 as my DB. I have
I am using Jboss and Netbeans to create Spring MVC web application on windows.
I am using spring mvc. I have 3 pages in my site (actually the
I am using spring 3 mvc/security frameworks. I have created a Controller class that

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.