Fork me on GitHub


  • Simple & Friendly
  • High-Performance
  • High-Quality


open source license

Apache License 2.0

Copyright 2011-2013 HTTL Team.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
See the License for the specific language governing permissions and
limitations under the License.

runtime environment

depends on:JDK1.5 +

default configuration, HTTL does not depend on any party libraries to run.

latest version

lateststableversion: 1.0.11, released on 2013-08-16 23 welcome to use.

This version mainly fixes the problems identified users, see:release notes

binary packages source code package Source Repository
HTTL core package httl-1.0.11.jar httl-1.0.11-sources.jar httl-1.0.11
Script Integration Pack httl-script-1.0.11.jar httl-script-1.0.11 -sources.jar httl-script-1.0.11
Servlet integration package httl-servlet-1.0.11.jar httl-servlet-1.0.11 -sources.jar httl-servlet-1.0.11
SpringMVC integrated package httl-springmvc-1.0.11.jar httl-springmvc-1.0.11 -sources.jar httl-springmvc-1.0.11
Struts integration package httl-struts-1.0.11.jar httl-struts-1.0.11 -sources.jar httl-struts-1.0.11
WebX integrated package httl-webx-1.0.11.jar httl-webx-1.0.11 -sources.jar httl-webx-1.0.11
JFinal integrated package httl-jfinal-1.0.11.jar httl-jfinal-1.0.11 -sources.jar httl-jfinal-1.0.11
Nutz integrated package httl-nutz-1.0.11.jar httl-nutz-1.0.11 -sources.jar httl-nutz-1.0.11
binary packages source code package Source Repository
Servlet Example httl-servlet-demo-1.0.11.war httl-servlet-demo-1.0.11
SpringMVC Example httl-springmvc-demo-1.0.11.war httl-springmvc-demo-1.0.11
Struts Example httl-struts-demo-1.0.11.war httl-struts-demo-1.0.11
JFinal Example httl-jfinal-demo-1.0.11.war httl-jfinal-demo-1.0.11
Nutz Example httl-nutz-demo-1.0.11.war httl-nutz-demo-1.0.11

Maven dependency

Released to maven central repository:


run the example

the war package on: tomcat/webapps/httl-springmvc-demo-1.0.11.war, and start tomcat,
Then visit: http://localhost:8080/httl-springmvc-demo-1.0.11

source code repository

can be used in the same way, the import MVC integration example source code.

download trunk Source:

git clone
cd httl

Alternatively, download the version Tag pack and unpack:

unzip httl-1.0.11
cd httl-1.0.11

compile source code:

mvn install-Dmaven.test.skip

generate Eclipse project description file:

mvn eclipse: eclipse-DdownloadSources

Import Eclipse Project:

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

will. httl format file to html editor opens:

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

installing Maven command line: (used to support the above mvn command)


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


Unzip apache-maven-2.2.1-bin.tar.gz
Desktop ->My Computer ->right-click menu ->System Properties ->Advanced ->Environment Variables ->in the PATH variable to add apache-maven-2.2.1/bin directory.

History Version

2013-06-23 1.0.10 httl-1.0.10.jar httl-1.0.10-sources.jar
2013-04-06 1.0.9 httl-1.0.9.jar httl-1.0.9-sources.jar
2013-02-23 1.0.8 httl-1.0.8.jar httl-1.0.8-sources.jar
2013-01-27 1.0.7 httl-1.0.7.jar httl-1.0.7-sources.jar
2013-01-05 1.0.6 httl-1.0.6.jar httl-1.0.6-sources.jar
2012-12-30 1.0.5 httl-1.0.5.jar httl-1.0.5-sources.jar
2012-11-23 1.0.4 httl-1.0.4.jar httl-1.0.4-sources.jar
2012-11-15 1.0.3 httl-1.0.3.jar httl-1.0.3-sources.jar
2012-11-04 1.0.2 httl-1.0.2.jar httl-1.0.2-sources.jar
2012-10-28 1.0.1 httl-1.0.1.jar httl-1.0.1-sources.jar
2012-10-06 1.0.0 httl-1.0.0.jar httl-1.0.0-sources.jar

Change History

1.0.11 (2013-08-16)

 # 151  forbid.method error
 # 150  dump data is empty, do not generate empty file
 # 149  trimBlankLine subscript out of range
 # 148  velocity compatible parsing gaps and $ handle
 # 146  open field can not be used directly
 # 144  all types of support and String equality comparison
 # 141  MVC integrated in getTemplate initial data types when an incoming
 # 140  do not know if this is a bug or unstable? Jsp caching no such problems!
 # 139  Javassist called method overloading public macro error occurs
 # 138  about the log issue
 # 137  # for Chinese colon unfriendly error message
 # 136  MVC integration is disabled by default output.writer
 # 134  Use HTTL integer equal to the judgment is incorrect
 # 133  precompiled into preload
 # 132  open debug mode, the console will complain. And fastjson version about?
 # 131  page is first loaded, parse relatively slow, and I opened the pre-compiled, the log shows the template found 0
 # 130  Deploy httl-servlet-demo-1.0.10.war project, the time of the visit can not find the class
 # 129  for template template variables to get the type of incoming
 # 128  template directory with no pre-compiled null pointer ClassPath
 # 111  to delete blank lines bug problem
 # 107  jndi not able to preload

1.0.10 (2013-06-23)

# 92Support # for (9) single-digit number of cycles
# 110increase # for (menu: menus.recursive) tree recursive method
# 113to increase support attribute syntax ifattr and setattr
# 114increase # macro ($ list =>cache) macro output filter support
# 115increase JFinal integration
# 59to increase integration Nutz

# 88TemplateParser.clean problems, leading to loss of the first instruction after the merger
# 89remove blank lines problem
# 94fix the problem
# 95if (B + C == A) error
# 97with :/ / protocol header directory without a preceding / root symbol
# 991.0.9 version # set does not support commas to separate multiple assignment statements
# 102escapeXml (byte []) error encountered Chinese
# 103ExpressionParser in backtick escape no effect
# 104macro defines a number of parameters, if not specified argument types, invocation parameter order will be a mess.
# 106modes = debug null pointer exception will be reported
# 108will be changed openReader Resource's getReader
# 109can comment on both sides with spaces

1.0.9 (2013-04-07)

1 increase Visitor, you can traverse the template syntax tree.
2 increase interpreted and explain compile mixed execution.
3. For circulatory support java wording
4. For circulatory support else
5 increase ArrayMapConverter
6 can be configured forbid.methods prohibited method name to call
7 In addition to the # break # for templates and macros can be interrupted
8 support is the operator, with the same instanceof
9. Increase store the generated java code parsing
10 Support for configuring multiple templates directory, separated by commas
11 prefixes such as classpath configuration location support
12 support literally Boxed figures, 3L generate java.lang.Long type

13 Configuration + = appended to the default configuration before
14. OutputStreamTemplate incoming Writer error, instead of converting
15 Tip # var variable name can not contain a dot
16 Encounter template type automatic do not filter
17 expression is not exposed as API, delete evaluate methods
18. Sequences into import.sequences
19 would generate compiled code into AST tree assembled visitors
20. Does not recognize a command is ignored
21 anomalies in the version given HTTL
22. GetVariables return type of variable is not defined
23 production mode, the template is not saved in memory, the source file

24. Repair # set and # for variable generic issues
25. Solve String [] statement, when the question of error
26. Solve JdkCompiler the ClassPath Find BUG
27 basic types of repair parameters corresponding method when the problem can not be found
28 For no return value and do not need to obtain the return value of a method call support issues
29 Fix the set command to identify problems upcast
30. Macro in super.fooMethod can not call a method with parameters
31. Macro compiled separately underwent number does not correspond with the original template
32 resolve name resolution problems word bread

1.0.8 (2013-02-23)

1 unified use # set directive, but keep compatibility
(2) support the Velocity syntax syntax Filter into Httl
3 support runtime context data dump
4 increase use.render.variable.type configuration
5 increase import.sizers configuration
6 increase modes = dev mode configuration
7. Increase logger.level configuration
8 would java.version configuration change compile.version
9 support from the JVM-D parameters and system environment variables to read configuration
10 configuration allows removal with less equal to the value of the default configuration section

11 would Comment and Attribute syntax handling to achieve Filter
12. Context creation process completed by the Engine
13. Context method to check all cross-thread call
14 Reconstruction Codec inherited from Formatter

15} No. repair string has the expression parsing error
16 repair javassist's for 1 .. 3 not compile
17 built-in JSON parsing fix Bean type conversion issue
18 Fix splicing errors

1.0.7 (2013-01-27)

1. allow the user need not declare # set() type, and at run time by getTemplate() parameter.
2 calls writer.write (String) into calling writer.write (char []), reduction in Writer char [] copy.
3. The filter (String) into filter (char []) and filter (byte []), optimizing the binary output filter performance.
4 The format() into toChars() and toBytes(), optimize the performance of the binary output format.
5 All StringUtils judgment instead use an empty string.
6 Incoming configPath empty automatically set the default path.
7. Increase response.encoding configuration items used to automatically set the response encoding.
8 As long as the same type, which allows repeated define the variable type.
9. Increase template.filters and expression.filters configuration items, and expressions for filtering template source.
10 increase the model Converter interface, allow incoming object properties as parameters instead of converting Map.
11 to increase the output Converter interface that allows incoming response, and the like, depending on the configuration automatically converted Writer or OutputStream.
12. Reconstruction WebEngine, it is only responsible for creating the Engine, without any render with logic, reducing hard-coded.
13 would default.parameter.type into default.variable.type, and servlet parameter to avoid confusion, do not force the issue and fix.
14 would default.variable.type default is set to java.lang.Object, without computing would not declare a variable type, can be directly output $ {obj}.
15 where there get (str), getProperty (str), getAttribute (str) method object can be directly accessed using $ {obj.str}.
16. MVC integration increases automatically import the cookie, parameter, header three Map variables, users can $ {} or $ {header.userAgent}
17 Fix error offset a problem of location information.
18. Char [] does not turn into a String, direct filtration output.
19 increase import.getters + = getAttribute configuration, $ {} will call aa.getAttribute ("bb")
20. Lint.chekced configuration is changed after an error on.
21. Switcher Interface to generics, which can switch the Filter and Formatter.
22. BeanFactory support @ Reqiured attribute disables the loading, such as no allocation extends.default, not loaded ExtendsInterceptor.
23 comment symbol can be configured, for example, the template used to generate the Java code can be dubbed: comment.left = / * and comment.right = * /.
24. Supports multiple templates suffixes, such as: template.suffix =. Httl,. Html
25. Solve omit the parentheses in the command, the mistake (a + b) * (c + d) to remove the brackets on both sides, leading to expression parsing error.
26 Support and Velocity no comment character like syntax, for example: # if (a == b) ... # end
27. Increase JsonMapConverter and StringBuilderOutConverter.
28. Allow # set (formatter = formatter.add ($ myFormatter))
29. # Set (filter = $ myFilter)
30 Support Codec expanded and built JSON codec implementation.

1.0.6 (2013-01-05)

1. the $! {extend ("/ layout.httl") into $! {extends ("/ layout.httl")} / / more than a month s, because we used to use plus s. extends
2 would be $! {} into $! {} / / method calls like Java, covering the same way as the parent class of the same name.
3 Support Template CoC automatically inherited, so that users do not have to write in each template extends statement.
4 would be set (a = b) written back to context, allowing intuitive semantics, increasing set (a. = B) indicates that only in the current template, template pairs hidden variables.
5 allows the user to set the default variable type default.parameter.type = String, var is not declared type, using the default type, reducing var declaration.
6 increase interceptors and listeners expansion interface, so that expansion could render the template before and after insertion logic.
7 When the # end with the start command does not match the number displayed when the # end location.
8. Evaluate and render increase throws ParseException, in order to avoid losing the position nested exception information.
9 solution containing the macro again within a macro parse error problem.
10 built-in Web integration, will output.encoding set for response, the output remains the same, to prevent distortion.
11 would context.getOutput() instead context.getOut() consistent with the JDK and JSP named.
12 built-MVC integration, will read on a recursive request attributes finished context.parent after the MVC regular convention consistent.
13 increase ScriptEngine integration, users can Script JDK standard interface calls HTTL.

1.0.5 (2012-12-30)

fix the problem:
1 repair nowadays standard array parameter value is null null pointer and a null handle large Boolean and increase all incoming null values ​​of the test.
(2) failure to solve the problem reflected Get session variables.
3 to solve the column number where the error parameter error problem.
4 Repeat variable declaration being given to solve the problem unfriendly and increased abnormal information assertion test cases.
5. Solve AdaptiveTemplate.getMacros() no adaptation problems, leading to stream and writer templates refer to each other.
6 Fix list() is not recursive search subdirectories files, resulting precompiled failures.
7 Fix + = appended with the parent configuration is configured as null, the configuration values ​​loss problems.
8 Fix: = assignment is not set to context.parent, causing the user can not access variables in the template after rendering.

Compatible optimization:
9 from the macro assignment render() method to move constructors to improve performance.
10. Include other support .. / relative path.
11 one yuan! Denial and | | or operators support string and list
12 allows this access template itself, for example: $ {} $ {this.encoding}
13 Only the variables used to generate an context.get() statement var useless to ignore in order to improve performance.

Incompatible optimization:
14 would be changed i18n message, and jstl, springmvc other naming consistent internationalization features affect the use of templates.

New features:
15 .. Add # {expression} placeholder represents compile execution, such as compile-time information or documents embed internationalization: # {message ("foo")}
16 increase locator extension points that allow the user to modify the loader without the case, change the location of the resource lookup establish mapping relationships.
17 sorting methods to increase collections: map.sort, collection.sort, array.sort.
18 Name increase conversion method: str.toCamelName, str.toCapitalName, str.toUnderlineName.
19 increase coding method: str.toMd5, str.toSha, str.toBase64, str.parseBase64.
20 .. Add text serialization methods: str.parseJson, obj.toJson, str.parseXml, obj.toXml, you need to configure fastjson and xstream dependency.
21 increase import.variables import parameters, users can use the same as JSP request, response, session and other implicit parameters.
22 increased $! {Extend ("/ layout.httl")} template inheritance feature, with the sub-template macro substitution parent template with the same name for the output.
23 The attribute syntax supports the attribute written comments to facilitate local implementation in the absence of labels, such as:
24 Support for the location of the variable, using different Filter, and increased Switcher extension point, you can customize the position of the switch.

1.0.4 (2012-11-23)

1. repair code generation template class array type name issue.
2 single quotes to a string backtick as char.
3 generated template class code only prints the log, do not put an exception message.
4 automatically delete the command line blank, and through remove.directive.blank configuration.
5 multi-Resolver and multi-Loader reverse order to find, easy + = Configuration, User Configuration takes precedence.
6. Set supports multiple assignments separated by semicolons.
7. For state stcak collection into parent chain.
8 Clean all Array.get() reflections.
9. ClassUtils increase property reflection cache.
10 allows separate settings template.cache.capacity and expression.cache.capacity.
11 Fix generate Java code, some method call does not generate null judgment.
12. Read, include adaptive return should be based on output type byte [] or String.
13 increase byte [] and char [] the toString processing.
14. Increase string.split (char) method.
15 Weak Object type parameter to increase the runtime byte [] judgment, to avoid being format() into a String, and then back to byte [] output.
16 print configuration directory and template loaded INFO logs, easy troubleshooting.
17 resolve Engine's properties after init() method assignment problem.
18. Repair set duplicate definition variable types, resulting JdkCompiler compilation to fail.
19 International Information not found, the display Key.
20. Changed from the same template Loader to load the internationalization information.
21 Instead, use EncodingProperties loaded international information, the user can save the file in UTF-8 international information, without the need ascii2native.
22 All Web integration eliminates the need to configure web.xml and ServletLoader, the default automatic configuration.
23 classes per repeat repair Compiler Compiler class meta information leading to the leakage problem.

1.0.3 (2012-11-15)

1. java.version default configuration items to automatically obtain the current version of the JDK.
2 fixes precompiled injection order problems.
3 repair cross configuration file $ configuration item reference issues.
4 increase ByteCache, reducing generate bytecode logic.
5 Check the locks escape, ByteOutput replaced UnsafeByteOutput, StringBuffer replaced StringBuilder so on.
6 In $! {Foo} for not filtered output, if the variable itself is byte [] or String type, directly to the output stream or writer, reducing transcoding.
7 Enhanced generics after the derivation set operations, such as: # for (book: booklist1 + booklist2).
8. Use google's ConcurrentLinkedHashMap do LRU cache implementation.
9 support the collection together, for example: array1 + array2, list1 + list2, map1 + map2.
10 The default import java.lang.Math a static method.
11 increase hasResource() determines whether the resource exists.
12 increase Resolver extension interface to obtain run-time properties, such as the internationalization of regional information request and the request encoding.
13 add"foo". Message() method to find ResourceBunlde international information, such as:
14 add"foo.httl". Locale() method to find international file name, such as: foo_zh_CN.httl.

1.0.2 (2012-11-04)

1. repair pressure measured under $ {evaluate ("1 + 2")} a large number of dynamic compilation compilation problems, growth problems and perm area, increasing class and instance cache.
2 fixes excessive pressure measured under WrappedMap instantiation problem, the delay to Context.getParameters() is called before creating.
3 repair pressure measured under StringUtils.escapedHtml() in a long string may cause an array of StringBuilder copy issues to new StringBuilder (len * 2).
4 repair pressure measured under ClassUtils.forName() takes more time to issue, increase the Map cache.
5 Fix ClassUtils.forName() does not support multidimensional arrays problem.
6. Repair under pressure measuring slower DateFormat find problems increase as the default format DateFormat independent ThreadLocal, reduced according to the format query Map cache.
7 repair AbstractTemplate's serialize does not use the configured character encoding issues.
8 Fix a (b()) functions of one variable parsing error.
9 configuration file to increase support a = $ b referencing other configuration items.
10 increase ClearBlankLineFilter used to remove static text blank lines.
11 increased $ {render ($ template)} dynamic templates evaluated.
12 Fix Loader loads the directory splicing errors.

1.0.1 (2012-10-28)

1. increase springmvc of ViewResolver integration.
(2) increase the struts Result and TemplateEngine integration.
3 increase webx of TemplateEngine integration.
4 increase slf4j log output, and set to the default.
5 increase jcl log output.
6 increase set (a: = b), for the parameters are written back to the Context parameter Map.
7 Allow include mass participation, such as: $! {Include ("aaa.httl", ["user": user,"age": 28])}
8 Optimize unescapeString and unescapeHtml performance.

1.0.0 (2012-10-06)

fix the problem:
1 to solve for, and if / else state Mansian when used in combination.
2 parse error problem solving getIsXxx property.
3 solution file is loaded using the specified encoding is not the problem.
4 part of the solution, not close the file stream open question.
5 iterations map error problem solving, as well as the type of data inference Map.

New features:
6 supports separate macro file defines macros method by import.macros configuration is loaded.
7. Increase gt, ge, lt, le symbols, attribute syntax expression appears to avoid HTML tags character.

Compatible optimization:
8 Static methods do not take engine.getFunction() Find instances directly call the static method.
9 access to all configuration setter injection, for example: setInputEncoding (String).
10 directly into the compiled template Macro property and increase template.getMacros() method.
11 incoming Map rendering process does not change the state guarantee of no side template rendering, as well as multiple rendering idempotent.
12 Optimizing Performance Profiler found ArrayIterator performance loss caused by the problem.
13. The text contents are not compiled into bytecode, instead retrieved from the cache, prevent memory Perm area is too large, and provide and switch items.

Incompatible optimization:
14 would define directive name changed var, and the velocity of the define directive in order to avoid confusion understanding, affecting all the old template, the user can replace text.
15 Remove block command with # set (xxx = xxxmacro()) instead affect the use of block templates.
16 would com.googlecode.httl into httl, affecting the API call, re-Ctrl + Shift + O to import about package names, class names have not changed.
17 would into httl.spi, affecting extension points in the configuration, use the default configuration values, it is recommended not to be assigned to the user configuration.
18. The filters configuration items into a value.filters, and text.filters on the application, the impact the filter extension point configuration.
19 The functions configuration items into import.methods, and import.macros correspond with import.packages easy to understand.
20. Plus Digital priority, as long as there is one that is changing as digital figures, such as:"2" + 3, Output: 5 instead of: 23, both sides must if you want the character to character juxtaposition:"2" + 3.toString

0.2.0 (2011-09-22)

1. increase comment syntax and set to default, such as:
(2) support hot load, when the file is changed, automatically reload configuration: reloadable = true
3 support startup precompiled configuration: precompiled = true
4 anomalies surrounding the content information display error location and easier troubleshooting
5.Support comment block, do not explain block escape special characters, such as: \ # \ $
6 support include, read, evaluate function (free to expand), such as: $ {include ("xxx.httl")]
7 support collections generic parameters, such as: # define (Listbooks)
8 automatic null pointer detection, such as: $ {user.role}, when the user is not a null pointer is null
9 automatic completion conditions, such as: # if (books) is equivalent to # if (books! = Null && books.size>0)
10 Support for the state stack, multilayer for, you can get through the $ {for.parent.index} upper for state
11 allows setting for state variable names
12 support brackets arrays, such as: # for (c: [a, b, c])
13. Supports dual point number sequences, such as: # for (c: a .. c) or # for (i: 1 .. 2) or # for (day:"Monday" .."Sunday")
14 Support for collection or operator to select the set is not empty, such as: # for (book: books1 | books2)
15 Support Date type comparison, such as: # if (date1>date2)
16 Support for new operations, such as: $ {new Date()}
17 Support casts, such as: # set (user = (User) param)
18 increased HttlServlet, support requests processed through the MVC framework and populate request attribute for page rendering forward to HttlServlet
19 compatible with JDK1.5, you need to configure: compiler =

0.1.0 (2011-09-15)

first version, basic functions, HTML attribute syntax parsing.
Migrate from a previous CommonTemplate.