HTTL(Hyper-Text Template Language)是一個適用於HTML輸出的開源JAVA模板引擎,適用於動態HTML頁面輸出,可用於替代JSP頁面,它的指令相似於Velocity。
HTTL採用相似於JSP的原理,將模板編譯成Java字節碼運行,但比JSP的EL更進一步,使用強類型推導,減小運行期反射和轉型,更加快速.html
缺省配置下,HTTL不須要依賴任何三方類庫便可運行。git
已發佈到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
|
git clone https://github.com/httl/httl.git
cd httl
|
或者,直接下載各版本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目錄。
|