Announcement Announcement Module
Collapse
No announcement yet.
Spring MVC 3.0.5 Image does not render Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring MVC 3.0.5 Image does not render

    I'm trying to load this image tux.png, but it's not rendering at all. It says
    "http://localhost:8080/appointapp/images/tux.png 404 (Not Found)" or
    "http://localhost:8080/appointapp/resources/images/tux.png 404 (Not Found) "

    This is one part of directory tree

    Code:
    |-- pom.xml
    |-- src
    |   |-- main
        |.....
    |   |-- resources
    |   |   |   |-- config.properties
    |   |   |   `-- images
    |   |   |       `-- tux.png
        `-- webapp
    I also added this to my spring configuration xml file:
    Code:
    <mvc:resources mapping="/resources/**" location="/resources/" />
    Finally, this is how I've tried to show the image, no successful though.

    Code:
    <img alt="Tux" src="resources/images/tux.png" />
    <img alt="Tux" src="/resources/images/tux.png" />
    <img alt="Tux" src="images/tux.png" />
    Any idea?
    Thanks in advance.

  • #2
    I had to use <c:url>
    <c:url value="/resources/images/tux.png" />
    Now it's working

    Comment

    Working...
    X