以前在使用SpringMVC时一直没注意到在web.xml中默认首页直接转到controller的问题,这两天在进行配置时才发现没我想的那么简单,不过其实也不难,查的各种资料因为不合适傻乎乎的绕了点弯路,但也算是解决了,所以记录下来,留个备忘。
之前访问主页地址为:http://xxxxxxx/xxxx/index.htm 但由于要求,需要去掉index.htm,直接访问地址就转到主页(index.htm是配置的controller地址)
<!--web.xml默认配置-->
<welcome-file-list>
<welcome-file>/index.html</welcome-file>
</welcome-file-list>
//controller配置