首页 » Andorid » 临时分类 » 正文

j2html

j2html

Java to HTML generator. Enjoy typesafe HTML generation.

The project webpage is j2html.com.

Getting started

Add the maven dependency


    com.j2html
    j2html
    1.4.0

Or the gradle dependency

compile 'com.j2html:j2html:1.4.0'

Import TagCreator and start building HTML

import static j2html.TagCreator.*;

public class Main {
    public static void main(String[] args) {
        body(
            h1("Hello, World!"),
            img().withSrc("/img/hello.png")
        ).render();
    }
}

The above Java will result in the following HTML:


    <h1>Hello, World!</h1>
    <img src="/img/hello.png">

Find more examples at http://j2html.com/examples.html

下载 (0)

发表评论