Java/SpringMVC起始页项目?
我正在尝试用java/spring/hibernate开发一个mvcweb应用程序 实际上,在我完成所有配置之后,我只有一个问题 这是我的web.xmlJava/SpringMVC起始页项目?,java,spring,spring-mvc,Java,Spring,Spring Mvc,我正在尝试用java/spring/hibernate开发一个mvcweb应用程序 实际上,在我完成所有配置之后,我只有一个问题 这是我的web.xml <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>BookStore</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationcontext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>mvc-dispatcher</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>mvc-dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
我得到了404错误。我必须使用http://localhost:8080/BookStore/index
我尝试在web.xml中添加此标记
<welcome-file-list>
<welcome-file>/index</welcome-file>
</welcome-file-list>
/索引
当我使用起始urlhttp://localhost:8080/BookStore/
要帮忙吗?谢谢您试过使用
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
index.jsp
?您可以在mvc-dispatcher-servlet.xml中添加以下行:
PS:您需要将mvc
模式添加到bean
根标记中:
<welcome-file-list>
<welcome-file>/index</welcome-file>
</welcome-file-list>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>