vs2019mvc显示index.html无法访问

html-css09

vs2019mvc显示index.html无法访问,第1张

vs2019mvc显示index.html无法访问是因为没有映射。根据相关公开资料查询了解到,在vs2019mvc项目中,url处理器没有映射会导致访问indexhtml时被拦截,无法正常访问。vs2019是一个基本完整的开发工具集,它包括了整个软件生命周期中所需要的大部分工具,如UML工具、代码管控工具、集成开发环境IDE等等。

通过试图解析器 以下是代码请供参考!

@RequestMapping("h_handelList")

    public ModelAndView h_handelList () throws Exception {

        ModelAndView mv = new ModelAndView()

        mv.setViewName("/WEB-INF/jsp/h_handelList.html")

        return mv

    }

也可以在springMVC.xml里配置试图解析器的前缀和后缀

<!-- 配置springmvc的视图解析器 -->

    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">

        <property name="prefix" value="/WEB-INF/jsp/"/>

        <property name="suffix" value=".html"/>

    </bean>

配置了前缀后缀后可以这样写:

@RequestMapping("h_handelList")

    public ModelAndView h_handelList () throws Exception {

        ModelAndView mv = new ModelAndView()

        mv.setViewName("h_handelList")

        return mv

    }

试图解析器是必须要配置的 可以不配置前缀后缀!