Skip to content

teggr/j2html-extensions

Repository files navigation

j2html-extensions

A collection of extensions for the j2html library, used for building HTML with java code.

Maven Central Version

What's in the box?

Quick Start

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")
        );

    }

}

Build and release

RELEASE.md

About

A set of extensions for the j2html library for building html with java code

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages