

As mentioned in other answers and documentation: Recently I had similar issue, but in my case, the spring security was making a problem. (I've never used thymeleaf, but that's what I deduce from the documentation).Īnd the test.png image should thus be in a folder images located under the root of the webapp. Thankfully, according to the thymeleaf documentation, thymeleaf understands that and provides a syntax for context-relative paths, which thus transforms paths like /images/test.png into /myWebApp/images/test.png. In the above example, /myWebAppis the context path of the application, that you typically don't want to hard-code in the path, because it might change. To be able to reference an image, whetever the URL of the page is, an absolute path is thus preferrable and easier to use.
Never enough thyme logo png free#
The browser starts from the root of the web server, and concatenates the absolute path. Thyme SVG and PNG, Botanical Hand Drawn Apothecary Elements, Herb Illustration, Commercial Free Graphic, Line Clip Art, Logo, Branding (587) 2. Then the browser will send a second request to the URL. This URL is, in a typical Spring MVC application, the URL of the controller where the initial request was sent. What matters is the URL of the page, as displayed in the address bar of the browser. The path of the server-side JSP or thymeleaf template is completely irrelevant here. Note that the absolute path is composed from the current "directory" of the page, concatenated with the relative path of the image. The URL of the image, since the path is relative, will be. Place thin slices of soft cheese across the tops of each quiche. Whisk the eggs, with garlic, salt, pepper and thyme until light and fluffy. The browser will send a second HTTP request to the server to load the image. Prepare the 4 pie crusts into the mini baking dishes or mason jar lids. The above image will be loaded from an application different from your context and if an application named billing-app is present in your server. Inside your application’s context, and therefore allow you to link to They do not assume you want your URL to be linking to a resource Server-relative URLs are very similar to context-relative URLs, except And your resources folder will probably under webapp folder of your application. When you hit in you browser then you should be able to access the image for the above syntax to work. Something navigated through roughly like, Myapp->webapp->images->test.png Server, our application will probably be accessible asĪs JB Nizet the following will work for you as I have used thymeleaf personally in a webapp project, Īnd the test.png should be under your project root inside the webapp folder. For example, if we deploy a myapp.war file into a Tomcat Relative to the web application root once it is installed on the

If you want to link resources inside your webapp then you should useĬontext relative urls. I want you to look into the Thymeleaf's documentation of Standard URL Syntax and specifically the context-relative and server-relative url patterns.
