spring webmvc mapping the jsp (without controllers)

后端 未结 6 1563
星月不相逢
星月不相逢 2021-01-03 09:47

I am trying to get my hands on Spring 3 web-mvc. I have a simple page link (you know.. thing.

Somehow spring mvc doesn\'t like th

6条回答
  •  一整个雨季
    2021-01-03 10:42

    After version 3.1 there is WebMvcConfigurerAdapter, so you can put the mapping in configuration like this:

    @Configuration
    @EnableWebMvc
    public class WebConfig extends WebMvcConfigurerAdapter {
    
      @Override
      public void addViewControllers(ViewControllerRegistry registry) {
        registry.addViewController("/").setViewName("/index");
      } 
    }
    

提交回复
热议问题