1
votes

Im having the same problem as mentioned here: Spring Boot Thymeleaf static content doesn´t load

My project Structure is the same as follow.

But my scene is:

Im getting 404 error looking the console, like:

Request URL:http://localhost:8080/dist/css/meuestilo.css
Request Method:GET
Status Code:404 
Remote Address:[::1]:8080

From Spring console, i get:

2017-02-15 23:44:23.160  WARN 8260 --- [nio-8080-exec-4] o.s.web.servlet.PageNotFound             : No mapping found for HTTP request with URI [/dist/css/meuestilo.css] in DispatcherServlet with name 'dispatcherServlet'

My link tag is:

<link rel="stylesheet" type="text/css" href="/dist/css/meuestilo.css" th:href="@{/dist/css/meuestilo.css}" />

What is wrong?

The template was created following this tutorial: http://blog.codeleak.pl/2013/11/thymeleaf-template-layouts-in-spring.html

Before changes, it works perfectly!

2
try to use th:href="@{/css/meuestilo.css}" reference instead.DimaSan

2 Answers

1
votes

I find a solution using:

layout:decorator 

As mentioned here Thymeleaf Layout Documentation

0
votes

As referring to your first link i believe that your meuestilo.css should be inside static/dist/css/meuestilo.css So your link tag should be like this,

<link rel="stylesheet" href="./dist/css/meuestilo.css">