1 Star 1 Fork 0

bearcat2 / spring-boot-jsp

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

spring-boot-jsp

介绍

springboot jsp 例子

软件架构

springboot、jsp

整合jsp步骤

  • pom.xml文件中将 <packaging>war</packaging> 打包方式变为war
  • 将内置的嵌入式servlet容器tomcat依赖的scope为provided
      <dependency>
              <groupId>org.springframework.boot</groupId>
              <artifactId>spring-boot-starter-tomcat</artifactId>
              <scope>provided</scope>
          </dependency>
  • 编写一个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

空文件

简介

使用springboot整合jsp,实现打成war包部署 展开 收起
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/bearcat2/spring-boot-jsp.git
git@gitee.com:bearcat2/spring-boot-jsp.git
bearcat2
spring-boot-jsp
spring-boot-jsp
master

搜索帮助

14c37bed 8189591 565d56ea 8189591