spring boot 新建jsp项目
1、添加spring boot parent,spring-boot-maven-plugin,spring-boot-starter-web,tomcat-embed-jasper(provided,省略版本号)。
2、编写入口类,在入口类可添加@RestController注解,这样入口类就可以支持RESTful访问
3、编写controller,添加@Controller注解,添加方法,添加@RequestMapping
4、编写jsp,在application.properties里添加spring.mvc.view.prefix=/WEB-INF/,spring.mvc.view.suffix=.jsp
<dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-dependencies</artifactId> <version>1.5.9.RELEASE</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement>