Beetl: The new Generation Java template engine paradigm

Source: Internet
Author: User

Beetl is the abbreviation of Bee template language, it is not simply another template engine, but a new generation of template engine, it is powerful, good performance, the second kill the current popular template engine. It is also easy to learn and use.

What is Beetl

Beetl current version is 2.8.5, compared to other Java template engine, with full-featured, intuitive syntax, high performance, and the template is easy to maintain and other features. Make it a good experience to develop and maintain templates. is a new generation of template engines. In a sense, it has the following characteristics:

    • Fully functional: As a mainstream template engine, Beetl has quite a few features and features that other template engines do not have. It is suitable for a variety of application Scenarios , from large Web sites with high response requirements to a wide range of CMS management systems. Beetl itself has many unique features to complete the template authoring and maintenance, which other template engines do not have.
    • Very simple: Similar to JavaScript syntax and custom, as long as half an hour can be half-learning half-guessing fully grasp the usage. Rejecting other template engines that non-human syntax and customs. It also supports HTML tags, making it easier to develop CMS systems
    • Ultra-high performance: Beetl far more than mainstream Java Template engine performance (engine performance 5-6 times and freemaker,2 times the JSP. Reference to the appendix) and consume a lower CPU.
    • Easy integration: Beetl can easily integrate with various web frameworks, such as spring Mvc,jfinal,struts,nutz,jodd,servlet.
    • Support templates are developed and tested separately, that is, in the MVC architecture, you can develop and test templates even without the M and C sections.
    • Extensions and Personalization: Beetl supports custom methods, formatting functions, virtual properties, tags, and HTML tags. At the same time Beetl also supports custom placeholders and control statement start symbols that also enable the user to create a toolkit that suits them.
    • Can be extended to the scripting engine, the rule engine, to customize the engine for advanced functionality.
about Performance

In the case of using Fastruntimeengine, BEETL6 is more than freemarker,2 times the JSP compared to the mainstream template engine freemarker,vecloity and JSP. This is because macro, through the optimization of the rendering engine, IO binary output, bytecode property access enhancement, micro, through a one-dimensional array preservation context, static text merge processing, by repeatedly using byte arrays to prevent Java frequently create and destroy arrays, also use template cache, Methods such as runtime optimization. See Appendix for details

Unique Features

Beetl Some features are not available in the more than 10-year-old template engine, which facilitates the development and maintenance of templates, as follows

    The
    1. custom placeholder and control statement start symbols help reduce template syntax's inclination to the template, such as in HTML templates, if the definition control statement symbol is <!--: and --> , Most template files can be opened through a browser. Some users only use a single symbol @   (or a single symbol " ~ ") and a carriage return as the starting symbol for the control statement, which can improve development efficiency
    2. templates that can be tested individually. Without a real control layer and model layer, BEETL templates can be developed and tested separately
    3. supports loosely mvc and strict MVC, if embedded in the template language expression, complex conditional expressions, and function calls are suspected of interfering business logic, You can disallow the use of these grammars.
    4. Powerful security output with safe output symbols! , can be in template variable, variable attribute reference, for loop, placeholder output, Try-catch medium Each place provides safe output, guarantee render normal.
    5. template variable: Run to assign a portion of the template output to a variable like JS, and then process it later. Template variables can be used to complete a very complex page layout (simple layouts can use the include,layout tag function)
    6. type speculation, to speculate on the template variable type at run time, to optimize performance, The Description template variable property (which is not required, but helps the IDE to automatically prompt the feature) can also be displayed by means of an annotated method
    7. pluggable design, error message hint, template engine caching mechanism, template resource management, local invoke security manager, strict MVC restriction, The template engine itself has a default implementation, but can be completely customized to fit specific requirements
    8. enhanced syntax, such as For-elsefor, select-case, security output symbols!, omitted ternary expressions, and so on, these syntaxes are especially suitable for template development
    9. Local rendering technology, combined with the current JS Ajax technology. The
    10. has a high performance, with the fastest template interpretation engine, with lower CPU consumption. 5-6 times the domestic use of freemaker. Suitable for a variety of template applications, such as code generation tools, CMS systems, ordinary websites, ultra-high-traffic portal systems, and rich client JS Framework integrated background management application
How does little white start
  • Need to read through the basic usage, most of it is to explain the syntax, and syntax is close to JS, so you can quickly preview, but Beetl is designed for the template, so like security output, tags and HTML tags, global variables, temporary variables and shared variables, layout technology, As well as calling Java code directly, you need to read it carefully.
  • If you are engaged in web development, you also need to read the first section of Web integration, "Web-provided global variables", if you also use AJAX technology in the Web, you can read "Integrated AJAX local rendering technology."
  • Contains Spring,jfinal,jodd,struts and other demos can be used as reference learning Https://git.oschina.net/xiandafu Any questions, can be asked in the ibeetl.com community. The current response rate is 100%, ask for details of their expectations, error messages, attached code or pictures

Original link: http://ibeetl.com

Beetl: The new Generation Java template engine paradigm

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.