在 spring mvc 中,如何使用 @RequestMapping link 到另一个 jsp?

In spring mvc, how to link to another jsp using @RequestMapping?

实际上,我有一个欢迎页面(welcome.jsp)。欢迎页面中有一个名为 "Contact us" 的 link。我还有contactinfo.jsp。我想将 link(联系我们)连接到 contactinfo.jsp。如何让它发挥作用?

我已经试过了,但是没有用。欢迎页面正在运行,但我单击 link "Contact us",它不会转到 contactinfo.jsp。下面是欢迎控制器:

@RequestMapping("/")
public String welcome(Model model) {

    model.addAttribute("greeting", "Welcome to Luke's Book Store!");
    model.addAttribute("tagline", "The one and only amazing web store");

    return "welcome";
}

@RequestMapping("/contactinfo")
public String contactinfo() {

    return "contactinfo";
}

这是我的 dispatcherServlet:

    <mvc:annotation-driven enable-matrix-variables="true"/>

<context:component-scan base-package="com.jiachangyang.ebookstore" />

<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    <property name="prefix" value="/WEB-INF/views/" />
    <property name="suffix" value=".jsp" />
</bean>

<bean id= "messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
    <property name="basename" value="messages"/> 
</bean>

<mvc:default-servlet-handler />
<mvc:resources mapping="/css/**" location="/WEB-INF/css/" />

这是"welcome.jsp"中的link:

<a href="contactinfo">Contact us</a>

试试这个:

<a href="location='contactinfo'">Contact us</a>

好的,我发现答案是 <a href="contactinfo">Contact us</a>

@RequestMapping("/contactinfo")
public String contactinfo() {

    return "contactinfo";
}