JSP不渲染-Springboot 2.1.1

时间:2018-12-22 12:24:47

标签: spring-boot

我正在使用Spring Boot 2.1.1,并在gradle文件中添加了以下依赖项

  dependencies {
    implementation(
            'org.springframework.boot:spring-boot-starter-web',
            'javax.servlet:jstl',
            'org.apache.tomcat.embed:tomcat-embed-jasper',
    )
    testImplementation('org.springframework.boot:spring-boot-starter-test')
}

application.properties

spring.mvc.view.prefix:/WEB-INF/jsp/
spring.mvc.view.suffix:.jsp

控制器类

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class HelloJsp {

    @RequestMapping(value="/welcome.html",method = RequestMethod.GET)
    public ModelAndView Hello(){
        return new ModelAndView("welcome");
    }
}

我也将jsp文件放在/webapp/WEB-INF/jsp/下  而我得到

  

找不到“ Whitelabel错误页面” 404错误

我想念什么吗?

0 个答案:

没有答案