NIUCLOUD是一款SaaS管理后台框架多应用插件+云编译。上千名开发者、服务商正在积极拥抱开发者生态。欢迎开发者们免费入驻。一起助力发展! 广告
注意:创建Springboot整合jsp,一定要为war类型 ,否则会找不到页面 1.pom文件引入以下依赖 ~~~ <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.0.0.RELEASE</version> </parent> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <!-- springboot web核心组件 --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> </dependency> <!-- springboot外部tomcat支持 --> <dependency> <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-jasper</artifactId> </dependency> </dependencies> ~~~ 2.在application.properties创建以下配置 ~~~ spring.mvc.view.prefix=/WEB-INF/js/ spring.mvc.view.suffix=.jsp ~~~ 3.后台代码 ~~~ @Controller public class JspController { @RequestMapping("/jspIndex") public String jspIndex(){ return "jspIndex"; } } ~~~ 4.启动代码 ~~~ @SpringBootApplication public class AppConfig { public static void main(String[] args) { SpringApplication.run(AppConfig.class, args); } } ~~~ ![](https://box.kancloud.cn/a24c274a4c78e17f25255008e0f970bf_218x79.png)