在spring URL中导航

时间:2014-11-17 07:17:05

标签: java spring url

我有关于导航的问题。

目前这是我的网址

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。

1 个答案:

答案 0 :(得分:1)

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

示例:

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