query-string
  • thymeleaf
  • 2017-05-10 76 views 0 likes 
    0

    如何Thymeleaf創建的網址:Thymeleaf:查詢字符串

    /user/map?userId=1&mapId=2 
    

    在thymeleaf模式,我有機會獲得$ {user.id}和$ {} map.id。

    我曾嘗試:

    th:href="@{'/user/map/update/?userId=' + ${user.id} + '&mapId=' + ${map.id}}" 
    

    但它給:

    The reference to entity "mapId" must end with the ';' delimiter. 
    
    +1

    你應該總是編碼和在HTML/XML''&。 – holmis83

    回答

    3

    Thymeleaf url expressions can do this for you.

    <a th:href="@{/user/map(userId=${user.id},mapId=${map.id})}"> 
    
    +0

    工程就像一個魅力! – Dachstein

    相關問題