A collection of extensions for the j2html library, used for building HTML with java code.
- j2html-extensions-core - Extensions for the core j2html classes and creators
- j2html-extensions-tools - Standalone module with utilities for generating code
- rebel-ui-test - Standalone module for testing UI rendering
- bootstrap-j2html-extension - Bootstrap lib
- htmx-j2html-extension - HTMX attributes
- j2html-generator - Webapp for generating j2html code from html
Add the following to your Maven pom.xml file.
<dependencyManagement>
<dependencies>
<dependency>
<groupId>dev.rebelcraft</groupId>
<artifactId>j2html-extensions-bom</artifactId>
<version>0.0.3</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
...
<dependency>
<groupId>dev.rebelcraft</groupId>
<artifactId>j2html-extensions-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>dev.rebelcraft</groupId>
<artifactId>bootstrap-j2html-extension</artifactId>
</dependency>
<dependency>
<groupId>dev.rebelcraft</groupId>
<artifactId>htmx-j2html-extension</artifactId>
</dependency>
Use the provided J2HtmlView objects to start building out your webmvc application.
@Controller
@RequestMapping("/")
public class HomeController {
@GetMapping
public String home() {
return "homeView";
}
}
...
@Component
public class HomeView extends J2HtmlView {
@Override
protected DomContent renderMergedOutputModelDomContent(
Map<String, Object> model,
HttpServletRequest request,
HttpServletResponse response) throws Exception {
return div().withClasses(Bootstrap.container).with(
p("Hello World")
);
}
}