https://github.com/mybatis/thymeleaf-scripting
Thymeleaf scripting plugin for MyBatis
https://github.com/mybatis/thymeleaf-scripting
java mybatis scripting
Last synced: 4 months ago
JSON representation
Thymeleaf scripting plugin for MyBatis
- Host: GitHub
- URL: https://github.com/mybatis/thymeleaf-scripting
- Owner: mybatis
- License: apache-2.0
- Created: 2018-11-19T00:32:28.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2025-07-05T19:12:27.000Z (12 months ago)
- Last Synced: 2025-07-05T20:28:56.128Z (12 months ago)
- Topics: java, mybatis, scripting
- Language: Java
- Homepage:
- Size: 3.26 MB
- Stars: 23
- Watchers: 5
- Forks: 6
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# MyBatis Thymeleaf 3 Support
[](https://github.com/mybatis/thymeleaf-scripting/actions/workflows/ci.yaml)
[](https://coveralls.io/github/mybatis/thymeleaf-scripting?branch=master)
[](https://maven-badges.herokuapp.com/maven-central/org.mybatis.scripting/mybatis-thymeleaf)
[](https://oss.sonatype.org/content/repositories/snapshots/org/mybatis/scripting/mybatis-thymeleaf/)
[](https://www.apache.org/licenses/LICENSE-2.0.html)

MyBatis Thymeleaf 3 Scripting Support.
## Introduction
The mybatis-thymeleaf is a plugin that helps applying a SQL using template provided by Thymeleaf 3.
If you are not familiar with Thymeleaf 3 syntax, you can see the Thymeleaf documentations.
* https://www.thymeleaf.org/doc/tutorials/3.0/usingthymeleaf.html#textual-template-modes
### Simple bindable 2-way SQL
```sql
SELECT * FROM names
WHERE id = /*[# mb:p="id"]*/ 1 /*[/]*/
```
### Dynamic bindable 2-way SQL
```sql
SELECT * FROM names
WHERE 1 = 1
/*[# th:if="${not #lists.isEmpty(ids)}"]*/
AND id IN (
/*[# mb:p="ids"]*/ 1 /*[/]*/
)
/*[/]*/
ORDER BY id
```
### Dynamic bindable SQL(non 2-way)
```sql
SELECT * FROM names
WHERE 1 = 1
[# th:if="${not #lists.isEmpty(ids)}"]
AND id IN (
[# mb:p="ids" /]
)
[/]
ORDER BY id
```
## Requirements
* Java 8, Java 11+
* MyBatis 3.4.3+ (Recommend to use 3.5+ or 3.4.x latest version)
* Thymeleaf 3.0+ (Recommend to use 3.0.x latest version)
## Documentation
* [Published User's Guide](https://www.mybatis.org/thymeleaf-scripting/user-guide.html)
* [Snapshot User's Guide](src/main/asciidoc/user-guide.adoc)
## Related Resources
* [Quick Start](https://github.com/mybatis/thymeleaf-scripting/wiki/Quick-Start)
* [Code completion](https://github.com/mybatis/thymeleaf-scripting/wiki/Code-completion)
* [Usage on framework](https://github.com/mybatis/thymeleaf-scripting/wiki/Usage-on-framework)
## Contact us
### Question
When there is a question, at first please confirm whether exists same question at following web sites.
* [Google group for mybatis user(official mailing list)](https://groups.google.com/forum/#!forum/mybatis-user)
* [Stack Overflow tagged mybatis](https://stackoverflow.com/questions/tagged/mybatis)
If you cannot find a same question, please post new question to the [mailing list](https://groups.google.com/forum/#!newtopic/mybatis-user) or the [Stack Overflow](https://stackoverflow.com/questions/ask?tags=mybatis,mybatis-thymeleaf).
### Report and Request
When you found a bug or want to submit a feature request(new feature or current feature improvement), at first please confirm whether exists same bug or request at following pages.
* [Issue List](https://github.com/mybatis/thymeleaf-scripting/issues)
* [Pull Request List](https://github.com/mybatis/thymeleaf-scripting/pulls)
If you cannot find a same report or request, please post new issue to the [issue tracker](https://github.com/mybatis/thymeleaf-scripting/issues/new).
> **IMPORTANT:**
>
> When you found a security vulnerability, at first please report it to the [mybatis organization members](https://github.com/orgs/mybatis/people) instead of issue tracker.