Skip to content

Commit 7e3e827

Browse files
committed
Update README.md
1 parent 0f56396 commit 7e3e827

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

README.md

+33
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,36 @@
22
Java to HTML generator. Enjoy typesafe HTML generation.
33

44
This project was inspired by [Gagawa](https://code.google.com/p/gagawa/)
5+
6+
##Getting started
7+
###Add the maven dependency
8+
```xml
9+
<dependency>
10+
<groupId>com.j2html</groupId>
11+
<artifactId>j2html</artifactId>
12+
<version>0.5.0</version>
13+
</dependency>
14+
```
15+
16+
###Import TagCreator and start building HTML
17+
```java
18+
import static j2html.TagCreator.*;
19+
20+
public class Main {
21+
public static void main(String[] args) {
22+
body().with(
23+
h1("Heading!").withClass("example"),
24+
img().withSrc("img/hello.png")
25+
).render();
26+
}
27+
}
28+
```
29+
The above Java will result in the following HTML:
30+
```html
31+
<body>
32+
<h1 class="example">Heading!</h1>
33+
<img src="img/hello.png">
34+
</body>
35+
```
36+
37+
Find more examples at http://j2html.com/examples.html

0 commit comments

Comments
 (0)