spring-mvc默认首页配置

一想到默认首页,很多人可能首先想到的是在web.xml如下配置:

<welcome-file-list>
    <welcome-file>xxxx/xxx</welcome-file>
</welcome-file-list>

但是不好意思,不可以。最终的解决方法,在spring-mvc.xml文件中加入以下配置,测试问题解决(需要删除webapp下边的index.jsp文件,否则tomcat容器环境下依然会访问到这个文件)

<mvc:view-controller path="/" view-name="redirect:/xx/xxx" />
原文地址:https://www.cnblogs.com/duanjt/p/10406945.html