首页 > 其他分享 >Spring Boot集成Jsp

Spring Boot集成Jsp

时间:2022-08-28 16:12:27浏览次数:46  
标签:tomcat Spring Boot Jsp webapp embed

1、创建webapp目录,并在Project Structure中设置为资源文件夹

2、导入依赖

<!-- 内嵌Tomcat对jsp的解析依赖 -->
<dependency>
    <groupId>org.apache.tomcat.embed</groupId>
    <artifactId>tomcat-embed-jasper</artifactId>
</dependency>

3、指定Jsp的编译路径

<build>
    <!-- 指定Jsp的编译路径 -->
    <resources>
        <resource>
            <!-- 源文件夹 -->
            <directory>src/main/webapp</directory>
            <!-- 编译位置 -->
            <targetPath>META-INF/resources</targetPath>
            <!-- 编译资源 -->
            <includes>
                <include>*.*</include>
            </includes>
        </resource>
    </resources>
</build>

4、配置视图解析器

spring:
  mvc:
    view:
      prefix: /
      suffix: .jsp

标签:tomcat,Spring,Boot,Jsp,webapp,embed
From: https://www.cnblogs.com/duya12345/p/16632946.html

相关文章

  • Spring 高级 初始化与销毁
    一初始化1、简介Spring提供了多种初始化手段,除了@PostConstruct,@Bean(initMethod)之外,还可以实现InitializingBean接口来进行初始化,如果同一个bean用了以上手......
  • spring学习
    pringBoot自动装配原理及分析通过注解@SpringBootApplication=>@EnableAutoConfiguration=>@Import({AutoConfigurationImportSelector.class})实现自动装配2)AutoConfigu......
  • Spring 高级 @Autowired 失效分析
    一、失效演示1、正常情况packagecom.mangoubiubiu.show.a06;importlombok.extern.slf4j.Slf4j;importorg.springframework.beans.factory.annotation.Autowired;......
  • 使用Gradle构建spring-boot多模块项目
    一、目录结构.├──boogle-common│  ├──build.gradle.kts│  └──src├──boogle-core│  ├──build.gradle.kts│  └──src├──......
  • Spring5.2.x-06-Spring扫描原理
    在ConfigurationClassPostProcessor内部完成扫描在扫描的时候,为什么要用asm,如果直接用类,可能会把static里的直接执行了,spring尽量做到不直接影响用户(比如这......
  • Spring 高级 Aware 接口及 InitializingBean 接口
    一、Aware1、Aware接口的作用Aware接口提供了一种【内置】的注入手段,例如BeanNameAware注入bean的名字BeanFactoryAware注入BeanFactory容器ApplicationC......
  • Referenced file contains errors (http://www.springframework.org/schema/beans/spr
    Referencedfilecontainserrors(http://www.springframework.org/schema/beans/spring-beans-3.0.xsd)._faihtua的博客-CSDN博客 https://blog.csdn.net/faihtua/arti......
  • Spring 高级 工厂后处理器模拟实现-Mapper
    一、源方式自动注入packagecom.mangoubiubiu.show.a05;importcom.alibaba.druid.pool.DruidDataSource;importcom.mangoubiubiu.show.a05.component.Bean2;impor......
  • Spring源码-自定义标签
    一、新建实体类publicclassUserimplementsSerializable{privateStringid;privateStringname;privateIntegerage;publicStringgetId(){ return......
  • spring源码具体细节 super setConfigLocations
      1首先先调用super父类构造方法 classPathXmlApplicaitonContext 初始化成员属性  依然掉父类构造方法 调用父类 资源处理器 当前系统需要运行所......