我正在使用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错误
我想念什么吗?