gpt4 book ai didi

java - 在 Spring URL 中导航

转载 作者:行者123 更新时间:2023-12-01 12:16:28 24 4
gpt4 key购买 nike

我有一个关于导航的问题。

目前这是我的网址

http://localhost:8080/spring/Account/ump

我想导航到

**http://localhost:8080/spring/Scheduler/test**
this is the URL i am trying to hit but i cannot find the correct ahref code to achieve

我的代码

<li><a href="/Scheduler/test">test page</a></li>

我尝试过其他替代方案,例如

<li><a href="redirect:/Scheduler/test">test page</a></li>

结果是

http://localhost:8080/Scheduler/test

对于重定向结果,它将是

redirect:/Scheduler/test

如果重要的话我会使用InternalResourceViewResolver。

最佳答案

如果您能够在页面上使用 JSTL,请使用核心 JSTL 中定义的 c:url 标记。 url 标记始终将实际上下文路径附加到 url 的开头。

示例:

<li>
<a href="<c:url value='/Scheduler/test'/>">test page</a>
</li>

关于java - 在 Spring URL 中导航,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26967437/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com