项目结构展示

在webapp目录下面手动创建JSP的目录和web.xml

创建web.xml只是为了不报错,在SpringBoot的项目中实际上用不到web.xml

打开pom.xml把框住的地方改成war,也就是maven的打包方式,默认的jar,如果要在项目中使用jsp的话就要改成war

pom里面添加下面的两个依赖

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</dependency> <dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency> application.properties 配置文件添加如下

#jsp 支持
spring.mvc.view.suffix=.jsp
spring.mvc.view.prefix=/WEB-INF/jsp/


#关闭默认模板引擎
spring.thymeleaf.cache=false
spring.thymeleaf.enabled=false

最后一点需要注意的是创建controller的时候类的注解要换成Controller不要再用RestController了

Spring Boot学习笔记(一)与JSP整合的更多相关文章

  1. Spring Boot 学习笔记(六) 整合 RESTful 参数传递

    Spring Boot 学习笔记 源码地址 Spring Boot 学习笔记(一) hello world Spring Boot 学习笔记(二) 整合 log4j2 Spring Boot 学习笔记 ...

  2. Spring Boot学习笔记2——基本使用之最佳实践[z]

    前言 在上一篇文章Spring Boot 学习笔记1——初体验之3分钟启动你的Web应用已经对Spring Boot的基本体系与基本使用进行了学习,本文主要目的是更加进一步的来说明对于Spring B ...

  3. spring boot整合jsp的那些坑(spring boot 学习笔记之三)

    Spring Boot 整合 Jsp 步骤: 1.新建一个spring boot项目 2.修改pom文件 <dependency>            <groupId>or ...

  4. Spring Boot 学习笔记--整合Thymeleaf

    1.新建Spring Boot项目 添加spring-boot-starter-thymeleaf依赖 <dependency> <groupId>org.springfram ...

  5. Spring Boot学习笔记:整合Shiro

    Spring Boot如何和Shiro进行整合: 先自定义一个Realm继承AuthorizingRealm,并实现其中的两个方法,分别对应认证doGetAuthenticationInfo和授权do ...

  6. Spring Boot 学习笔记--整合Redis

    1.新建Spring Boot项目 添加spring-boot-starter-data-redis依赖 <dependency> <groupId>org.springfra ...

  7. Spring Boot学习笔记 - 整合Swagger2自动生成RESTful API文档

    1.添加Swagger2依赖 在pom.xml中加入Swagger2的依赖 <!--swagger2--> <dependency> <groupId>io.spr ...

  8. Spring Boot学习笔记(五)整合mybatis

    pom文件里添加依赖 <!-- 数据库需要的依赖 --> <dependency> <groupId>org.mybatis.spring.boot</gro ...

  9. Spring Boot学习笔记二

    Spring Boot入门第二篇 第一天的详见:https://www.cnblogs.com/LBJLAKERS/p/12001253.html 同样是新建一个pring Initializer快速 ...

随机推荐

  1. java简单的运算符和表达式

    1.运算符的运算级别分为很多层,第一层是(),括号的运算级别最高. 第二层是+,——,*,/,加,减,乘,除 第三层是==,等于号. 第四层是&&,||,或 与 且 && ...

  2. MyBatisSystemException->BindingException: Parameter 'xxx' not found. Available parameters are [arg1, arg0, param1, param2]

    最近在使用Spring boot+mybatis做新的基础框架,结果碰到如下问题: 1 org.mybatis.spring.MyBatisSystemException: nested except ...

  3. [转] Nexus OSS 3.xx 体验

    [From] https://blog.csdn.net/qq250782929/article/details/51605965 Nexus Manager OSS 3.0 —Maven Repos ...

  4. linux inotifywait 下监控是否有IO

    帮助: JDU:/host-001e67a8d50b /log/today # inotifywait -h inotifywait 3.14 Wait for a particular event ...

  5. CentOS7编译curl

    1.下载curl源代码 https://curl.haxx.se/download.html 2.进入curl目录 ./configure --prefix=/usr/local/curl make ...

  6. Paths

    Paths 在javax.tools.StandardLocation 枚举类下定义了几个枚举变量,如下: public enum StandardLocation implements Locati ...

  7. 警告: Hessian/Burlap: 'com.github.pagehelper.Page' is an unknown class in WebappClassLoader

    项目中使用mybatis的分页插件pagehelper出现下面的警告 出现上面的警告,并不影响程序的运行.但是毕竟看着比较闹心. 使用debug进行代码根据发现,执行的过程中使用到了pagehelpe ...

  8. Linux 操作系统常用的三种流012

    Linux 操作系统常用的三种流: 0 标准输入流 1 标准输出流 2 标准错误流 通常在写脚本启动程序,写log时候,会出现如下写法: nohup commod > log.txt 2> ...

  9. JavaScript数据结构-13.散列碰撞(开链法)

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

  10. python egg for centos 制作

    经常接触Python的同学可能会注意到,当需要安装第三方python包时,可能会用到easy_install命令.easy_install是由PEAK(Python Enterprise Applic ...