1.在web.xml中加入
<welcome-file-list> <welcome-file></welcome-file> </welcome-file-list>
此時,web服務器就知道,根路徑不要web服務器來處理,而是由程序自身來處理。
然後在spring的配置文件中加入<mvc:view-controller path="/" view-name="forward:/index"/> :表示當訪問主頁時自動轉發到index控制器
<mvc:view-controller path="/" view-name="login/login"/> :表示跳轉到login.jsp頁面