zoukankan      html  css  js  c++  java
  • Thtmeleaf的URL

    1,URL表达式

      1),语法

        在Thymeleaf中URL表达式语法为@{}

      2),绝对路径

        <a th:href="@{http://www.baidu.com}">绝对路径</a>

      3),相对路径

        相对于当前项目的根

        <a th:href="@{/show2}"></a>

        相对于服务器路径的根

        <a th:href="@{~/项目名/请求名}"></a>

    2,在URL中转递参数

      1),普通URL传递参数

        [1]静态参数

        <a th:href="@{/show?id=1&name=zhangsan}">普通URL传递参数一</a>

        <a th:href="@{/show(id=2,name=lishi)}">普通URL传递参数二</a>

        [2]动态参数

        <a th:href="@{'/show?id='+${id}+'&name='+${name}}"></a>

        <a th:href="@{/show(id=${id},name=[${name})}"></a>

      2),在restful格式的URL中传递参数

        <a th:href="@{/show/{id}/{name}(id=200,name=zhaoliu)}"></a>

        实例:

          

          

         <a th:href="@{/show/{id}(id="100",name="zhaoliu")}"></a>

        实例:

          

          

             

            <a th:href="@{show/{id}(id=${id1},name=${name1})}"></a>

  • 相关阅读:
    解决运行vue项目的报错This relative module was not found:
    Iterator 迭代器
    Strategy 策略模式
    Observer 观察者
    工厂模式总结(简单工厂,工厂方法,抽象工厂)
    Abstract Factory 抽象工厂
    Factroy 简单工厂
    Singleton 多线程
    Singleton 单例模式
    设计模式总结
  • 原文地址:https://www.cnblogs.com/yz-bky/p/12792606.html
Copyright © 2011-2022 走看看