Displaying active navigation based on contextual data

后端 未结 6 1256
礼貌的吻别
礼貌的吻别 2021-02-07 00:36

I have the following separated fragment in a Thymeleaf template.

6条回答
  •  萌比男神i
    2021-02-07 01:02

    For those using Thymeleaf 3:

    Home
    

    If you have a context path on your application:

    Home
    

    Edit:

    To be concise:

    Home
    

    The benefit to using request.getServletPath() is that it ignores the context path, if there is one.

提交回复
热议问题