https://github.com/hexaredecimal/jtempl
A templating engine for Java, inspired by JSP
https://github.com/hexaredecimal/jtempl
Last synced: about 1 year ago
JSON representation
A templating engine for Java, inspired by JSP
- Host: GitHub
- URL: https://github.com/hexaredecimal/jtempl
- Owner: hexaredecimal
- License: mit
- Created: 2024-12-13T15:19:16.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-26T20:51:29.000Z (over 1 year ago)
- Last Synced: 2025-03-26T21:35:05.392Z (over 1 year ago)
- Language: Java
- Size: 197 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# JTempl
>> A html/Template to java class translation tool
## Why?
Hard to find standalone tools that do this which are not intergrated with some system
## Features
- Simple Syntax (Uses %% instead of context based tags unlike jsp (<= vs <% etc))
- Translates to readable java code
- Repl support
## Usage
```sh
$ jtmpl -p com.your.webapp -d src/com/your/web/app index.xhtml
```
This will create a file called Index.java with the template code inside a static method called generate.
You can use the template like this in your code, especially when using BlazingwebX.
```java
@Get("/")
public static home(BlazingResponse response) {
var page = IndexTemplate.generate();
response.setHeader("Content-Type", "text/html");
response.sendResponse(page);
}
```
## Examples
JTempl has a syntax similar to JSP and uses `%%` to start and end template insertions. Examples are available in the examples directory.