thymeleaf 在 html和js 中拼接字符串

一、th:text字符串和事件拼接

    1. <span th:text="'Welcome,'+${user.name}">

    2.  <span th:text="|Welcome, ${user.name}|">

    3. input type="button" th:οnclick="|javascript:fungetone(${con.uid})|" value = "修改" />

    4. <a href="javascript:void(0) th:οnclick='${"goRead("+menu.***+")"}'>

    5. 亲测这种可以

       

       

二、th:action字符串拼接

  <form th:action="@{'/user/'+${user.userId}}"></form>
  <form th:action="@{/user/{userId}(userId=${user.userId})}"></form>

 

JavaScript中

  <script th:inline="javascript">
  $("#content").html(
    "<select name='status'>"+
    " <option value=''>[[#{admin.common.choose}]]</option>"+
    " <option value="+[[${status}]]+">[[#{'Order.Status.' + ${value}}]]</option>"+
    "</select>");
  </script>

三 拼接url和href

  src示例:

  <img th:src="@{/img/research/{filename}(filename=${research.filename})}">
  href示例:

  <a th:href="@{'https://'+${url.url}}" th:text="${url.urlName}"></a>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值