Skip to content

Tag: thymeleaf

Cannot open index page in Thymeleaf, getting 404 in Intellij IDEA

I’ve created simple demo for Spring boot and Thymeleaf, but I cannot open index page. Controller code: Having index template in /src/main/resources/templates/index.html Having application.properties: server.port=9095 And going to the address http://localhost:9095/ And getting error: Spring boot class is: and pom.xml contains spring-boot-starter-thymeleaf and spring-boot-starter-web. Answer As described in following answer, Intellij IDEA had outdated dependencies, so helped buttons Reload all

Template might not exists

Im trying to call restapi and im getting error org.thymeleaf.exceptions.TemplateInputException: Error resolving template [view-fields], template might not exist or might not be accessible by any of the configured Template Resolvers at org.thymeleaf.engine.TemplateManager.resolveTemplate(TemplateManager.java:869) ~[thymeleaf-3.0.12.RELEASE.jar:3.0.12.RELEASE] at org.thymeleaf.engine.TemplateManager.parseAndProcess(TemplateManager.java:607) ~[thymeleaf-3.0.12.RELEASE.jar:3.0.12.RELEASE] at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1098) ~[thymeleaf-3.0.12.RELEASE.jar:3.0.12.RELEASE] at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1072) ~[thymeleaf-3.0.12.RELEASE.jar:3.0.12.RELEASE] at org.thymeleaf.spring5.view.ThymeleafView.renderFragment(ThymeleafView.java:366) ~[thymeleaf-spring5-3.0.12.RELEASE.jar:3.0.12.RELEASE] at org.thymeleaf.spring5.view.ThymeleafView.render(ThymeleafView.java:190) ~[thymeleaf-spring5-3.0.12.RELEASE.jar:3.0.12.RELEASE] at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1400) ~ etc properties Maybe this would help Answer According to

SpringMVC with Bootstrap and Thymeleaf pages decoration

I am working in: “SpringMVC 5”, with “Twitter Bootstrap 4” html pages, and “Thymeleaf 3” templating, in IntelliJ EAP (latest version) and Tomcat9, Maven The structure of my project: I am using these tutorials: https://www.baeldung.com/spring-thymeleaf-fragments https://www.thymeleaf.org/doc/tutorials/3.0/usingthymeleaf.html#template-layout I have my page (home.html). I have my template (template.html). According to the 2nd tutorial: I inserted the “menubar” into the “template” (this insert

Recieve a Map from a HTML form with Thymeleaf

I’m working on a project with Spring Web and Thymeleaf (this is my first time using Thymeleaf) and I have this requirement: The user needs to see a single form to fill a table with 32 rows and 4 columns, all at once. Edit. Each row has a fixed key (just for clarification) My first (naive) approach was to make

How to use explicit links with Thymeleaf?

I wanted to make and link to external site in Spring+Thymeleaf web application and inserted link like this: <a th:href=”@{https://example.com}”>Link</a> However by clicking the link it tries to point internal location http://localhost/service/https://example.com not external website https://example.com like it supposed to. Site gives just an error “status”:500,”error”:”Internal Server Error”,”message”:”The request was rejected because the URL was not normalized.” What’s wrong and

How to refer to a static method in Thymeleaf html in java?

I need to use the getMoneyIntoWords() method in the invoice html. But I am getting errors. Refer the code and errors below // Added below method in MoneyUtil.java Error: Answer You need special syntax to call a static method in Thymeleaf: You will need to use the full qualified name of the MoneyUtil class.