https://github.com/hendisantika/spring-boot-jte1
Spring Boot JTE Sample
https://github.com/hendisantika/spring-boot-jte1
jte spring-boot template-engine
Last synced: 3 months ago
JSON representation
Spring Boot JTE Sample
- Host: GitHub
- URL: https://github.com/hendisantika/spring-boot-jte1
- Owner: hendisantika
- Created: 2025-04-07T01:22:03.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2026-03-20T20:40:21.000Z (4 months ago)
- Last Synced: 2026-03-21T11:38:36.011Z (4 months ago)
- Topics: jte, spring-boot, template-engine
- Language: Java
- Homepage:
- Size: 219 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Spring Boot JTE
A Java Template Engine is a tool that allows developers to generate HTML, XML or other text-based formats using
templates. These templates are typically written in a mix of static text and dynamic placeholders, which are replaced
with actual data at runtime. Here are some key points about Java Template Engines:
1. **Separation of Concerns**: They help in separating the presentation layer from the business logic, making the code
more maintainable and easier to understand.
2. **Dynamic Content**: They allow the creation of dynamic web pages by embedding variables and control structures (like
loops and conditionals) within the templates.
3. **Popular Java Template Engines**:
- **Thymeleaf**: A modern server-side Java template engine for web and standalone environments.
- **Freemarker**: A Java-based template engine focused on MVC frameworks.
- **Velocity**: An older template engine that is still in use for various applications.
- **JTE**: A compile-time checked template engine that ensures type safety and fast rendering.
4. **Integration with Frameworks**: Most Java template engines integrate seamlessly with popular Java web frameworks
like Spring Boot, making it easy to use them in web applications.
5. **Template Syntax**: Each template engine has its own syntax for defining templates. For example, JTE uses `@` for
directives and `${}` for variable interpolation.
6. **Performance**: Some template engines, like JTE, focus on performance by compiling templates to Java code, which can
be faster than interpreting templates at runtime.
Here is an example of how a template engine might be used in a Spring Boot application:
```java
@Controller
public class ExampleController {
@GetMapping("/example")
public String example(Model model) {
model.addAttribute("message", "Hello, World!");
return "exampleTemplate";
}
}
```
And the corresponding template (`exampleTemplate.jte` for JTE):
```unknown
@template.layout.main(content = @`
${message}
`)
```
In this example, the `TemplateController` adds a message to the model, which is then rendered in the
`exampleTemplate.jte` template. The placeholder `${message}` is replaced with the actual message at runtime.
### Things todo list
1. Clone this repository: `git clone https://github.com/hendisantika/spring-boot-jte1.git`
2. Navigate to the folder: `cd spring-boot-jte1`
3. Run the application: `mvn clean spring-boot:run`
4. Open your favorite browser: http://localhost:8080/
### Image Screen Shot
Home Page

Team Page

Project Page
