/ Thymeleafと同じ/ <%= request.getContextPath()%> - java、spring、spring-boot、thymeleaf

Thymeleafに相当する<%= request.getContextPath()%> - java、spring、spring-boot、thymeleaf

Spring Initializer、埋め込みTomcat、Thymeleafテンプレートエンジン、および実行可能JARファイルとしてのパッケージを使ってSpring Boot Webアプリケーションを生成しました。

使用テクノロジ:

Spring Boot 2.0.0.M6、Java 8、maven

私はこのプロパティを自分で定義しています application.properties

server.servlet.context-path=iberiaWebUtils

Thymeleafテンプレートに以下と同等のものがあるかどうかを知りたいです。

<a href="/<%=request.getContextPath()%>/iberiaReport/download">

回答:

回答№1は2

得られる server.servlet.context-path 〜と

${#httpServletRequest.getContextPath()}

そして、あなたはただ書くことができます

<a href="@{/iberiaReport/download}">