File tree 1 file changed +33
-0
lines changed
1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 2
2
Java to HTML generator. Enjoy typesafe HTML generation.
3
3
4
4
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
You can’t perform that action at this time.
0 commit comments