将应用程序上下文路径附加到 spring 启动应用程序中的超链接
append application context path to the hyperlink in spring boot application
我在 application.properties 文件中添加了以下命令。
server.contextPath=/SpringBootOracle
现在,我在 html 页面中有一个 hyperlink,如下所示
<a href="/product/new">New Product</a>
每次点击link,都会跳转到
localhost:8080/product/new
有什么方法可以将应用程序上下文附加到 link 以便我可以在下面找到?
localhost:8080/SpringBootOracle/product/new
如果你使用 thymeleaf,那么试试这个:
<a th:href="@{/product/new}">New Product</a>
我在 application.properties 文件中添加了以下命令。
server.contextPath=/SpringBootOracle
现在,我在 html 页面中有一个 hyperlink,如下所示
<a href="/product/new">New Product</a>
每次点击link,都会跳转到
localhost:8080/product/new
有什么方法可以将应用程序上下文附加到 link 以便我可以在下面找到?
localhost:8080/SpringBootOracle/product/new
如果你使用 thymeleaf,那么试试这个:
<a th:href="@{/product/new}">New Product</a>