Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hexaredecimal/jtempl
A templating engine for Java, inspired by JSP
https://github.com/hexaredecimal/jtempl
Last synced: about 1 month 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 (about 1 month ago)
- Default Branch: main
- Last Pushed: 2024-12-13T15:42:06.000Z (about 1 month ago)
- Last Synced: 2024-12-13T17:15:12.322Z (about 1 month ago)
- Language: Java
- Size: 178 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# JTempl
>> A templating library for JAVA inspired by the one seen on tsoding streams
>> used to created templates for c.## Why?
- Learn how templating engines work and how to implemented one
- I got free time on my hands.
- Why not.
>> This is a naive implementation and it is ment to be as simple as possible to learn and use.## Usage
```sh
$ java -jar JTempl-dist.jar -package com.your.webapp -dir src/com/your/web/app index.jsp
```
This will create a file called IndexTemplate.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);
}
```## TODO
- Support receiving user arguments on the generate method.
- Make this a library as well.## Examples
JTempl has a syntax similar to JSP and uses a single `%` to start and end template insertions. Examples are available in the examples directory.