Jquery 使用串联动态生成表达式时,thymeleaf内联文本不起作用

Jquery 使用串联动态生成表达式时,thymeleaf内联文本不起作用,jquery,jquery-file-upload,thymeleaf,Jquery,Jquery File Upload,Thymeleaf,我正在Spring MVC项目中使用Thymeleaf。我需要使用作为查询字符串的一部分提供的id动态构建数据url。我正在使用JQuery上载插件上载所附的文档 这是必需的输出(对于serverId=10的给定查询字符串) 这是Thymeleaf代码 <input id="fileupload" type="file" name="files[]" th:inline="text" data-url="/upload?myId=[[${serverId}]]"/> 我还尝

我正在Spring MVC项目中使用Thymeleaf。我需要使用作为查询字符串的一部分提供的id动态构建数据url。我正在使用JQuery上载插件上载所附的文档

这是必需的输出(对于serverId=10的给定查询字符串)


这是Thymeleaf代码

<input id="fileupload" type="file" name="files[]" th:inline="text" data-url="/upload?myId=[[${serverId}]]"/>

我还尝试了变体,但将th:inline移动到父标记,并尝试了th:inline的none和javascript值。我尝试过的其他变体是

<input id="fileupload" type="file" name="files[]" th:inline="text" data-url="[[@{/upload/${serverId}}]]">

<input id="fileupload" type="file" name="files[]" th:inline="text" data-url="[[/upload/${serverId}]]">

这些都不管用<代码>${serverId}仅当它是纯文本时才被解析,但如果尝试以任何其他方式使用它,它将不起作用。尝试了th:with和th:attr的不同组合,但尚未成功


有人有过类似的问题吗?请建议。

我能自己解决这个问题。我不得不使用
th:attr

<input id="fileupload" type="file" name="files[]" th:inline="text" data-url="" th:attr="data-url=@{'/upload?myId='+${serverId}}"/>  

或者,如果我可以通过传递相同的serverId将参数传递给jquery file upload plugin,也可以这样做。
<input id="fileupload" type="file" name="files[]" th:inline="text" data-url="" th:attr="data-url=@{'/upload?myId='+${serverId}}"/>