# spring-boot-jsp
**Repository Path**: bearcat2/spring-boot-jsp
## Basic Information
- **Project Name**: spring-boot-jsp
- **Description**: 使用springboot整合jsp,实现打成war包部署
- **Primary Language**: Unknown
- **License**: Not specified
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 1
- **Forks**: 0
- **Created**: 2019-07-03
- **Last Updated**: 2020-12-16
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# spring-boot-jsp
#### 介绍
springboot jsp 例子
#### 软件架构
springboot、jsp
#### 整合jsp步骤
- pom.xml文件中将 `war` 打包方式变为war
- 将内置的嵌入式servlet容器tomcat依赖的scope为provided
```
org.springframework.boot
spring-boot-starter-tomcat
provided
```
- 编写一个SpringBootServletInitializer子类,并调用configure方法,将主类传入
```
public class ServletInitializer extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(SpringBootJspApplication.class);
}
}
```
- 配置外部的tomcat,运行
注意:
1. springboot内置的嵌入式servlet容器如tomcat不支持jsp,所以要使用jsp需使用外部的tomcat容器
2. 不要使用启动springboot主程序来运行,需启动外部tomcat