Spring MVC 下index.jsp访问

spring-mvc.xml配置

    <!-- 对模型视图名称的解析,即在模型视图名称添加前后缀 -->
    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"
        p:prefix="/WEB-INF/pages/" p:suffix=".jsp" />

所以jsp页面是放置在/WEB-INF/pages下面的,那么要访问/index.jsp怎么访问?

1.没有定义index Controller;当在浏览器中输入http://localhost:8080/springDemo/ 时,它会默认的去找项目的根目录/index.jsp 或/index.html
2.直接输入http://localhost:8080/springDemo/index.jsp也可直接访问到

原文地址:https://www.cnblogs.com/liaojie970/p/5525509.html