springMVC 项目欢迎页问题,大侠解释下。
url-pattern设置为“/”,为什么welcome-file设置为jsp文件,欢迎页可以定位到,当welcome-file设置为html文件,欢迎页却是404。
工程里面index.jsp和index.html在同一个路径。里面没有做任何跳转。
<welcome-file-list>
<welcome-file>index.jsp</welcome-file> <!---输入http://localhost:8080/SpringMVC-01/ 可以跳转到欢迎页--->
<welcome-file>index.html</welcome-file> <!---输入http://localhost:8080/SpringMVC-01/ 报404错误--->
</welcome-file-list>
<servlet>
<servlet-name>springMVC01</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>springMVC01</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
index.jsp 和index.html代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
嗨喽!!
</body>
</html>