如何使用百里香包含外部javascript文件?

Chi*_*may 1 spring-mvc thymeleaf

我正在使用Spring Boot / MVC并学习Thymeleaf。

假设我的脚本位于另一台服务器上。

https://staticserver.com/main.js

我已经在模型中添加了“ //staticserver.com”部分jsLocation

我想做以下事情:

<script src="${jsLocation}/main.js"></script>

这将使

<script src="//staticserver.com/main.js"></script>

Flo*_*cke 5

<script th:src="|${jsLocation}/main.js|"></script>
Run Code Online (Sandbox Code Playgroud)