java.lang.Object
io.jooby.thymeleaf.ThymeleafModule
- All Implemented Interfaces:
Extension
Thymeleaf module: https://jooby.io/modules/thymeleaf.
Usage:
{
install(new ThymeleafModule());
get("/", ctx -> {
User user = ...;
return new ModelAndView("index.html")
.put("user", user);
});
}
The template engine looks for a file-system directory: views
in the current user
directory. If the directory doesn't exist, it looks for the same directory in the project
classpath.
Template engine supports the following file extensions: .thl
, .thl.html
and .html
.
You can specify a different template location:
{
install(new ThymeleafModule("mypath"));
}
The mypath
location works in the same way: file-system or fallback to classpath.
Direct access to TemplateEngine
is available via require call:
{
TemplateEngine engine = require(TemplateEngine.class);
}
Complete documentation is available at: https://jooby.io/modules/thymeleaf.- Since:
- 2.0.0
- Author:
- edgar
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Utility class for creatingTemplateEngine
instances. -
Constructor Summary
ConstructorsConstructorDescriptionCreates module module using the default template path:views
.ThymeleafModule
(String templatesPath) Creates module which look at the given path.ThymeleafModule
(Path templatesPath) Creates module which look at the given path.ThymeleafModule
(org.thymeleaf.TemplateEngine templateEngine) Creates a new module uses the given template engine. -
Method Summary
Modifier and TypeMethodDescriptionstatic ThymeleafModule.Builder
create()
Creates a new thymeleaf builder.void
-
Constructor Details
-
ThymeleafModule
public ThymeleafModule(@NonNull org.thymeleaf.TemplateEngine templateEngine) Creates a new module uses the given template engine. You can create a default engine using thecreate()
method.- Parameters:
templateEngine
- Template engine.
-
ThymeleafModule
Creates module which look at the given path. It first look at the file-system or fallback to classpath.- Parameters:
templatesPath
- Template path.
-
ThymeleafModule
Creates module which look at the given path.- Parameters:
templatesPath
- Template path.
-
ThymeleafModule
public ThymeleafModule()Creates module module using the default template path:views
. It first look at the file-system or fallback to classpath.
-
-
Method Details