img no trim using Thymeleaf, spring boot (with Maven)

Asked

Viewed 1,656 times

0

The image I want to add is in the following directory:

/src/main/resources/static/images/logo.png

And the HTML tag looks like this:

<img width="220px" height="70px" th:src="@{/static/images/logo.png}"/> 

However, I get the following message when I try to access the image:

There was an Unexpected error (type=Not Found, status=404). No message available

If you need to know, my index code:

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8" />
<title>Empresa | Simulado </title>
<link href="/static/images/favicon.ico" rel="icon" type="image/x-icon" />
</head>

<body>
    <br />
    <h1 align="center">Teste</h1>
    <img height="70px" width="220px" src="/static/images/logo.png" />

Ps: Favicon appears normally

  • The image logo.png is in the directory static/images/ ?

  • Yes! The strange thing is that if I change the end of the source to: /Static/images/favicon.ico .

  • I even saw this question: https://stackoverflow.com/questions/29460618/inserting-an-image-from-local-directory-in-thymeleaf-spring-framework-with-mave

  • This error message that returns is in Console browser ?

  • No console do navegador aparece: Failed to load Resource: the server responded with a status of 404 ()

1 answer

1


Browser other questions tagged

You are not signed in. Login or sign up in order to post.