java - Why thymeleaf template does not processing? -
i have simple template print list of item
client side spring-boot. when try run error:
error 5434 --- [nio-8080-exec-4] org.thymeleaf.templateengine
: [thymeleaf][http-nio-8080-exec-4] exception processing template "get_all_items": error resolving template "get_all_items", template might not exist or might not accessible of configured template resolvers 2017-08-22 19:37:31.302 error 5434 --- [nio-8080-exec-4] o.a.c.c.c.[.[.[/].[dispatcherservlet] : servlet.service() servlet [dispatcherservlet] in context path [] threw exception [request processing failed; nested exception org.thymeleaf.exceptions.templateinputexception: error resolving template "get_all_items", template might not exist or might not accessible of configured template resolvers] root causeorg.thymeleaf.exceptions.templateinputexception: error resolving template "get_all_items", template might not exist or might not accessible of configured
this first time when use thymeleaf, please, me fix this. thank you.
this controller:
@getmapping("/get_all_items") public modelandview getallitems() { final modelandview model = new modelandview(); final list<item> = service.getall(); model.addobject("items", all); return model; }
this mvc config:
@override public void addviewcontrollers(viewcontrollerregistry registry) { registry.addviewcontroller("/get_all_items").setviewname("all_items"); registry.addviewcontroller("/login").setviewname("login"); }
html:
<!doctype html> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3"> <head> <meta charset="utf-8" /> <title>all</title> </head> <body> <table> <tbody> <tr th:each="item: ${items}"> <td th:text="${item.author}"></td> <td th:text="${item.name}"></td> </tr> </tbody> </table> <a href="/login?logout">log out</a> </body> </html>
update:
application.properties
spring.datasource.url=jdbc:postgresql://127.0.0.1:5432/spring_boot spring.datasource.username=**** spring.datasource.password=**** spring.datasource.driver-class-name=org.postgresql.driver
wiki
Comments
Post a Comment