Trying out thymeleaf without success

thymeleaf tutorial
spring boot thymeleaf configuration
thymeleaf th:selected
thymeleaf examples
thymeleaf tutorial w3schools
thymeleaf template resolver
thymeleaf documentation
thymeleaf validation and error messages

I am trying to use thymeleaf as it is described in all tutorials but somehow my HTML doesn't get loaded.

Here is my project structure:

And these are dependencies:

dependencies {
    testCompile group: 'junit', name: 'junit', version: '4.12'
    compile group: 'org.thymeleaf', name: 'thymeleaf', version: '2.0.5'

It does nothing much but prints out "Hello" message, however, the HTML from resources folder is not used. What am I missing?

The has only 1 method:

  public String hello(Model model, @RequestParam(value="name", 
    required=false, defaultValue="World") String name) {
    model.addAttribute("name", name);
    return "hello " + name;

And main method is just the usual run.

model.addAttribute makes it possible to get the data in your html file. The return in your method should return the name of the template you want. For example your hello.html

In your hello.html place something like this:

<p th:text="${name}"></p>

Then it should work.

Your controller look something like this, so the return contains your template name hello from hello.html:

@RequestMapping(value="/hello", method= RequestMethod.GET)
public String hello(Model model, @RequestParam(value="name", required=false, defaultValue="World") String name) {
model.addAttribute("name", name);
return "hello";

General Usage, Hi, I've been trying to create an app with spring 4.3.9 + Thymeleaf 3.0.6. Unfortunately I'm stucked but without success, it doesn't work either. Try doing that with JSP! In this course you are guided step by step in building an ecommerce like web application using Thymeleaf, Spring MVC, and Spring Boot. The focus of the course is on building web content with Thymeleaf.

You have to change your dependencies, instead of org.thymeleaf you need the following dependency:

compile group: 'org.springframework.boot', name: 'spring-boot-starter-thymeleaf', version: '1.5.1.RELEASE'

I hope this resolves your issue.


Updating HTML and Resources without restarting application server , I'm really trying but without success. I'm testing with a Maven web project, spark java framework and thymeleaf template engine, running on  Thymeleaf has also been designed from the beginning with Web Standards in mind – especially HTML5 – allowing you to create fully validating templates if that is a need for you. 1.2 What kind of templates can Thymeleaf process? Out-of-the-box, Thymeleaf allows you to process six kinds of templates, each of which is called a Template Mode

You might be using incorrect annotation for controller.



Here is example:

public class MyController {

@RequestMapping(value="/hello", method= RequestMethod.GET)
public String hello(Model model, @RequestParam(value="name", required=false, defaultValue="World") String name) {
  model.addAttribute("name", name);
  return "hello";

layout:decorate does not work · Issue #194 · ultraq/thymeleaf-layout , Versions 2.4.1 and 2.4.0 are not working in this case: Hi there, I've spent a while trying to recreate the issue but without success. nothing is really sticking out to me that could be the cause of the error you're getting. Are you able to try the 2.5.0-SNAPSHOT version of the layout dialect in your project to  Trying out thymeleaf without success. Ask Question Asked 1 year, 5 months ago. Active 1 year, 3 months ago. Viewed 96 times 2. I am trying to use thymeleaf as it is

Spring Boot Hello World Example – Thymeleaf –, Put spring-boot-starter-web and spring-boot-starter-thymeleaf , it will Read this – Spring Boot – Developer tools Try to modify the Thymeleaf templates For Intellij IDEA, extra steps are required, read this reload static file is not working To those having errors with this example, simple comment out this  Thymeleaf has complete support for HTML5 (even with Spring 3.0), so we will only have to change the type of our input and add a placeholder, and it will work out of the box, correctly binding our property and integrating with Spring MVCs property editors and more importantly, being displayed as a usual input box when displayed as a prototype

Spring Request Parameters with Thymeleaf, Learn how to use request parameters with Spring and Thymeleaf. form, the value of the parameter action will be either check-in or check-out. When we are successfully logged out, the browser is redirected to /login?logout so we can display an logout success message by detecting if the parameter logout is non-null. 4 The username should be present on the HTTP parameter username

Spring MVC part IV: ThymeLeaf advanced usage, This post follows on from the previous post on Thymeleaf integration with In this case there is no need to define the fragment_name with and everything that follows this expression will be stripped out. <span class = "alert alert-success" th:text= "${'User login Email check failed, please try again. Add Login to Your Spring Boot App in 10 Mins This brings in the Thymeleaf templating engine, the default web templating engine for use with Spring Boot. Now, you’re ready to try it out

  • Could you provide all the relevant code or a link to a repository? This way we can analyze all the necessary parts and help you further. Thank you in advance :)
  • Could you provide the whole code of the controller?
  • What code do you have in your Application class, html file and the whole controller? then we can try to reproduce the issue
  • I actually have that line in html but it still doesn't work. I changed return of my method to just return "hello" and still nothing. On the web page i just see "hello" string.
  • @marti6addams Have you tried: @RequestMapping(value="/hello", method= RequestMethod.GET) or @GetMapping("/hello")
  • hmmm, i tried it and got exception: 2018-08-01 16:11:30.528 ERROR 10908 --- [nio-8080-exec-2] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Circular view path [hello]: would dispatch back to the current handler URL [/hello] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)] with root cause
  • I renamed my html but now nothing is displayed at all
  • Please be aware that if you're using other's content, you must include proper attribution.