我有一个弹簧应用程序,我有控制器
@RequestMapping(value = "/candidateHome", method = RequestMethod.GET)
public ModelAndView candidateHome() {
return new ModelAndView("candidateHome", "command", new Candidate());
}
jsp名称candidateHome
web.xml文件
<servlet>
<servlet-name>rest</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>rest</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/rest-servlet.xml</param-value>
</context-param>
and servlet config file rest-servlet.xml
<context:component-scan base-package="com.ojp.controller" />
<mvc:annotation-driven />
<bean id="viewResolver" class= "org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/" />
<property name="suffix" value=".jsp" />
</bean>
当我尝试访问http://localhost:8080/RBTech/candidateHome时, 我收到错误'HTTP Status 404 - /RBTech/WEB-INF/candidateHome.jsp'。
任何人都可以告诉我这段代码有什么问题。感谢