Compared with other java template engines, Beetl has complete functions, intuitive syntax, super high performance, and a good experience in developing and maintaining templates. It is a new generation of template engine.
Generally speaking, its characteristics are as follows
1. Complete functions: Compared with mainstream java template engines, Beetl has most functions. It is suitable for various application scenarios, from large websites with high requirements on response speed to CMS management systems with many functions. Beetl itself also has many unique features to complete template writing and maintenance, which other template engines do not have.
2. Very simple: similar to Javascript syntax and customs, it only takes half an hour to fully master the usage through half-learning and half-guessing. Reject the impersonal syntax and conventions of other template engines.
3. Ultra-high performance: Beetl far exceeds the performance of mainstream java template engines, such as 5-6 times that of freemarker and 2 times that of traditional jsp technology. And consumes less CPU
4. Easy to integrate: Beetl can be easily integrated with various web frameworks, such as Spring MVC, JFinal, Struts, Nutz, Jodd, Servlet, etc.
5. Support template independent development and testing, that is, in MVC architecture, templates can be developed and tested even without M and C parts.
6. Extension and personalization: Beetl supports custom methods, formatting functions, virtual attributes, tags, and HTML tags. At the same time, Beetl also supports custom placeholders and control statement starting symbols, and allows users to create toolkits that suit themselves.
Compared with the mainstream template engines Freemarker, Velocity and JSP, Beetl is much higher than the previous three. This is because at a macro level, it has passed the optimized rendering engine, IO binary output, and bytecode attribute access enhancements. At a micro level, it has passed One-dimensional arrays save context, merge static text, prevent Java from frequently creating and destroying arrays by reusing byte arrays, and also use template caching, runtime optimization and other methods.
Beetl has some functions that template engines that have been developed for more than 10 years do not have. These functions are very conducive to the development and maintenance of templates, as follows
1. Customize placeholders and control statement starting symbols, which is helpful to reduce the intrusion of template syntax into templates. For example, in HTML templates, if the control statement symbols are defined, then most template files can use the same Open via browser. Some users only use a single symbol @ and carriage return as the starting symbol of the control statement, which can improve development efficiency.
2. Templates that can be tested individually. Beetl's templates can be developed and tested independently without the need for real control and model layers.
3. Supports both loose MVC and strict MVC. If embedding calculation expressions, complex conditional expressions, and function calls in the template language is suspected of interfering with business logic, you can prohibit the use of these syntaxes.
4. Powerful safety output, through safety output symbols! , can provide safe output in template variables, variable attribute references, for loops, placeholder output, try-catch and other places to ensure normal rendering.
5. Template variables: Run and assign a certain part of the template output to a variable like js, and process it later. Very complex page layouts can be completed using template variables (for simple layouts, the layout tag function can be used).
6. Type inference can infer template variable types at runtime to optimize performance. Template variable attributes can also be displayed through annotations (this is not necessary, but it is helpful for the IDE's automatic prompt function).
7. Pluggable design, error message prompts, template engine caching mechanism, template resource management, locally called security manager, strict MVC restrictions, the template engine itself has a default implementation, but it can be completely customized to suit specific needs. need.
8. Enhanced syntax, such as #ajax partial rendering, for-elsefor, select-case, safe output symbols!, etc. These syntaxes are particularly suitable for template development.
9. Ultra-high performance, with the fastest template interpretation engine and low CPU consumption. Suitable for all types of template references, such as CMS systems and ultra-high-traffic portal systems.