I'm using Spring Boot / MVC and learning Thymeleaf.
Let's say i have my scripts on another server.
https://staticserver.com/main.js
I've added the '//staticserver.com' portion to my model as jsLocation.
I want to do something on the lines of:
<script src="${jsLocation}/main.js"></script>
which would render
<script src="//staticserver.com/main.js"></script>
<script th:src="|${jsLocation}/main.js|"></script>
You can include external js file like below :
<script th:src="source to your external JS"></script>
You can refer below thread for more details as your query also relates to model.
Thymeleaf external javascript file shares the module attributes with html file
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With