https://github.com/tipsy/j2html
Java to HTML generator. Enjoy typesafe HTML generation.
https://github.com/tipsy/j2html
html-generator html5 java template-engine
Last synced: 7 months ago
JSON representation
Java to HTML generator. Enjoy typesafe HTML generation.
- Host: GitHub
- URL: https://github.com/tipsy/j2html
- Owner: tipsy
- License: apache-2.0
- Created: 2015-04-22T16:24:53.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2024-05-14T19:41:27.000Z (over 1 year ago)
- Last Synced: 2025-04-12T03:44:47.752Z (8 months ago)
- Topics: html-generator, html5, java, template-engine
- Language: Java
- Homepage: https://j2html.com/
- Size: 4.38 MB
- Stars: 771
- Watchers: 34
- Forks: 137
- Open Issues: 25
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
- stars - tipsy/j2html
README
[](https://github.com/tipsy/j2html/actions)


# j2html
Java to HTML generator. Enjoy typesafe HTML generation.
The project webpage is [j2html.com](http://j2html.com).
## Getting started
### Add the maven dependency
```xml
com.j2html
j2html
1.6.0
```
### Or the gradle dependency
```
compile 'com.j2html:j2html:1.6.0'
```
### Import TagCreator and start building HTML
```java
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:
```html
Hello, World!
```
Find more examples at http://j2html.com/examples.html