當請求路徑為目錄(以 / 結尾)時,Servlet 容器按 web.xml 中 <welcome-file-list> 順序查找文件:
<welcome-file-list>
<welcome-file>login.jsp</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<c:redirect url="/login.action"/> 或 response.sendRedirect。@RequestMapping("/") 方法返回 redirect:/login。web.xml 的 welcome-file-list。Filter 映射 /* 或 /。sendRedirect、forward 到 login.action 的位置。