httl開源JAVA模板引擎,動態HTML頁面輸出

HTTL(Hyper-Text Template Language)是一個適用於HTML輸出的開源JAVA模板引擎,適用於動態HTML頁面輸出,可用於替代JSP頁面,它的指令相似於Velocity。
HTTL採用相似於JSP的原理,將模板編譯成Java字節碼運行,但比JSP的EL更進一步,使用強類型推導,減小運行期反射和轉型,更加快速.html

缺省配置下,HTTL不須要依賴任何三方類庫便可運行。git

  二進制包 源代碼包 源碼倉庫
HTTL核心包 httl-1.0.11.jar httl-1.0.11-sources.jar httl-1.0.11
Script集成包 httl-script-1.0.11.jar httl-script-1.0.11-sources.jar httl-script-1.0.11
Servlet集成包 httl-servlet-1.0.11.jar httl-servlet-1.0.11-sources.jar httl-servlet-1.0.11
SpringMVC集成包 httl-springmvc-1.0.11.jar httl-springmvc-1.0.11-sources.jar httl-springmvc-1.0.11
Struts集成包 httl-struts-1.0.11.jar httl-struts-1.0.11-sources.jar httl-struts-1.0.11
WebX集成包 httl-webx-1.0.11.jar httl-webx-1.0.11-sources.jar httl-webx-1.0.11
JFinal集成包 httl-jfinal-1.0.11.jar httl-jfinal-1.0.11-sources.jar httl-jfinal-1.0.11
Nutz集成包 httl-nutz-1.0.11.jar httl-nutz-1.0.11-sources.jar httl-nutz-1.0.11
  二進制包 源代碼包 源碼倉庫
Servlet示例 httl-servlet-demo-1.0.11.war httl-servlet-demo-1.0.11.zip httl-servlet-demo-1.0.11
SpringMVC示例 httl-springmvc-demo-1.0.11.war httl-springmvc-demo-1.0.11.zip httl-springmvc-demo-1.0.11
Struts示例 httl-struts-demo-1.0.11.war httl-struts-demo-1.0.11.zip httl-struts-demo-1.0.11
JFinal示例 httl-jfinal-demo-1.0.11.war httl-jfinal-demo-1.0.11.zip httl-jfinal-demo-1.0.11
Nutz示例 httl-nutz-demo-1.0.11.war httl-nutz-demo-1.0.11.zip httl-nutz-demo-1.0.11

Maven依賴

已發佈到Maven中央庫:http://central.maven.org/maven2/com/github/httl/github

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
< project >
     < dependencies >
         < dependency >
             < groupId >com.github.httl</ groupId >
             < artifactId >httl</ artifactId >
             < version >1.0.11</ version >
         </ dependency >
         <!--
         <dependency>
             <groupId>com.github.httl</groupId>
             <artifactId>httl-script</artifactId>
             <version>1.0.11</version>
         </dependency>
         <dependency>
             <groupId>com.github.httl</groupId>
             <artifactId>httl-servlet</artifactId>
             <version>1.0.11</version>
         </dependency>
         <dependency>
             <groupId>com.github.httl</groupId>
             <artifactId>httl-springmvc</artifactId>
             <version>1.0.11</version>
         </dependency>
         <dependency>
             <groupId>com.github.httl</groupId>
             <artifactId>httl-struts</artifactId>
             <version>1.0.11</version>
         </dependency>
         <dependency>
             <groupId>com.github.httl</groupId>
             <artifactId>httl-webx</artifactId>
             <version>1.0.11</version>
         </dependency>
         <dependency>
             <groupId>com.github.httl</groupId>
             <artifactId>httl-jfinal</artifactId>
             <version>1.0.11</version>
         </dependency>
         <dependency>
             <groupId>com.github.httl</groupId>
             <artifactId>httl-nutz</artifactId>
             <version>1.0.11</version>
         </dependency>
         -->
     </ dependencies >
< project >

運行示例

將war包放到:tomcat/webapps/httl-springmvc-demo-1.0.11.war,並啓動tomcat,
而後訪問:http://localhost:8080/httl-springmvc-demo-1.0.11web

源代倉庫

能夠用一樣的方式,導入MVC集成示例源碼。spring

下載主幹源碼:apache

1
2

或者,直接下載各版本Tag包,並解壓:tomcat

1
2
3
unzip httl-1.0.11.zip -d httl-1.0.11
cd httl-1.0.11

編譯源碼:mvc

1
mvn install -Dmaven.test.skip

生成Eclipse工程描述文件:app

1
mvn eclipse:eclipse -DdownloadSources

導入Eclipse工程:eclipse

Eclipse -> File -> Import -> Existing Projects into Workspace -> Browse -> Finished

將.httl文件以html編輯器格式打開:

Eclipse -> Window -> Preferences -> General -> Content Types -> Text -> HTML -> Add -> *.httl

安裝Maven命令行:(用於支持上面的mvn命令)

Linux:

1
2
3
tar zxvf apache-maven-2.2.1-bin.tar.gz
export PATH=$PATH:apache-maven-2.2.1/bin

Windows:

 

1
2
3
解壓 apache-maven-2.2.1-bin.tar.gz
桌面 -> 個人電腦 -> 右鍵菜單 -> 系統屬性 -> 高級 -> 環境變量 -> 在PATH變量中加入apache-maven-2.2.1/bin目錄。
相關文章
相關標籤/搜索