Context relative path seems not to work

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Context relative path seems not to work

steppinrazor
I have this context relative path:

<link href="../../resources/css/bootstrap.css" rel="stylesheet" th:href="@{/resources/css/bootstrap.css}" />

but the css file does not resolve and the page renders with no css. I've attached an image for my project layout

Reply | Threaded
Open this post in threaded view
|

Re: Context relative path seems not to work

Zemi
Administrator
Please look at the generated HTML source code. Which CSS path do you see? It matches your CSS path? Is it work when you type that path into your browser directly?
Reply | Threaded
Open this post in threaded view
|

Re: Context relative path seems not to work

steppinrazor
The generated source is "localhost:8080:context_path/resources/css/bootstrap.css" which is what I would expect.

I can't get to it directly when I type the path in the browser or if I twiddle with the path in Firebug. So this behavior is strange, I've done similar with Freemarker so it's puzzling why this would not work now.
Reply | Threaded
Open this post in threaded view
|

Re: Context relative path seems not to work

Zemi
Administrator
Assuming that there is a typo in that URL (the colon after the port number), if you can't access the URL directly the problem is not related to Thymeleaf, check the configuration of your static resources.
Reply | Threaded
Open this post in threaded view
|

Re: Context relative path seems not to work

steppinrazor
Yup def a typo