Create your Gitee Account
Explore and code with more than 5 million developers,Free private repositories !:)
Sign up
模板引擎,java实现,小巧 & 高性能,语法类似javascript,支持自定义函数,全局变量,Lambda表达式 spread retract

http://zqq90.github.io/webit-script/

Clone or download
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README.md

Webit Script

QQ群: 302505483 Bitdeli Badge Build Status

This is a template engine, all writen in Java, support Java 5+.

Maven

<dependency>
  <groupId>com.github.zqq90.webit-script</groupId>
  <artifactId>webit-script</artifactId>
  <version>1.5.1</version>
</dependency>

Yeah, only one jar

webit-script-1.5.1.jar <300KB

How to use

Engine engine = Engine.create("/webit-script-config.props", extraSettings);
Template template = engine.getTemplate("/your/template/path/filename.ext");
template.merge(parametersMap, outputStream); 
//template.merge(parametersMap, writer);

Hello Webit Script

Hello Webit Script!
<%
var books;
{
    for(book : books){
%>
${for.iter.index}.${book.name} ${book.price}
<%
    }
}
{
    //this is a function
    var func = function(a, b){
        return a + b + arguments[3];
    };
    echo func("a", "b", "c");
    echo '\n';
}
{
    var map = {
        1: 1,
        "key2": "value2",
        3: 2 + 1
    };
    map[5] = 2 + 3;
    for(key, value : map){
        echo key + ":" +value + "\n";
    }
}
%>

More examples

Official Support

  • Jodd Madvoc
  • JFinal
  • Spring MVC
  • Struts2
  • Servlet & Filter

Demo

Performance(性能)

// Waiting update

License

Webit Script is released under the BSD License. See the bundled LICENSE file for details.

Webit Script 依据 BSD许可证发布。详细请看 LICENSE 文件。

Third-party Licenses

Bug report

github-issue OSC-issue

Comments ( 0 )

Sign in for post a comment