一、必须将项目打包成war包

<packaging>war</packaging>

二、pom.xml加入依赖包

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!--jsp支持-->
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<scope>compile</scope>
</dependency>

三、application.properties

spring.mvc.view.prefix=/WEB-INF/jsps/
spring.mvc.view.suffix=.jsp
spring.thymeleaf.cache=false    //这个是关闭thymeleaf缓存
spring.thymeleaf.enabled = false  //关闭thymeleaf模板

四、在项目中src/main/下建立 webapp/WEB-INF/jsps/

五、controller

@Controller
public class TestController {
  @RequestMapping("jsps")
public ModelAndView testJsp(){
return new ModelAndView("index");
}
}

六、访问 http://localhost:8080/jsps ok。

spring boot 学习笔记(二) 构建web支持jsp的更多相关文章

  1. Spring Boot学习笔记二

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

  2. Spring Boot学习笔记(二二) - 与Mybatis集成

    Mybatis集成 Spring Boot中的JPA部分默认是使用的hibernate,而如果想使用Mybatis的话就需要自己做一些配置.使用方式有两种,第一种是Mybatis官方提供的 mybat ...

  3. 【Spring Boot学习之二】WEB开发

    环境 Java1.8 Spring Boot 1.3.2 一.静态资源访问 动静分离:动态服务和前台页面图片分开,静态资源可以使用CDN加速;Spring Boot默认提供静态资源目录位置需置于cla ...

  4. Spring Boot学习笔记(二)全局捕获异常处理

    非常简单只需要创建自己的异常处理类,加上两个注解,就可以了

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

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

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

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

  7. Spring Boot学习记录(二)--thymeleaf模板 - CSDN博客

    ==他的博客应该不错,没有细看 Spring Boot学习记录(二)--thymeleaf模板 - CSDN博客 http://blog.csdn.net/u012706811/article/det ...

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

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

  9. 【spring boot 学习笔记】日志相关

    1. 如何启用日志? maven依赖中添加:spring-boot-starter-logging <dependency> <groupId>org.springframew ...

随机推荐

  1. ContentProvider小结

    1.什么情况下需要使用ContentProvider 跨进程提供数据访问的接口,如果在同一个App下,没有必要使用此种方式 2.自定义ContentProvider public class MyCo ...

  2. Windows Azure初体验

    目前在IT界,云这个概念的第一意思不再是词典里的解释了.不过它们还是有相同点的——也许确实会酝酿出一块大蛋糕,可也是飘在天上,众神分食之,与我等P民无关.所谓云,不过是网络时代发展到一定阶段的必然产物 ...

  3. Lenovo ThinkPad W520 4282-A76

    processor: Intel Quad Core i7-2630QM (2GHz, 8MB L3, 1333MHz FSB, 45W) graphics adapter: NVIDIA Quadr ...

  4. JavaScript中的分支结构

    说到JavaScript中的分支结构,我们就不得不提到流程控制这个词,我们所有的程序都是由数据和算法组成的.程序=数据+算法通常我们所说的算法都可以通过"顺序","分支& ...

  5. 时间服务器:NTP 服务器

    15.1 关于时区与网络校时的通讯协议   使得每一部主机的时间同步化.   DHCP 客户端/服务器端所需要的租约时间限制. 网络侦测时所需要注意的时间点.刚刚谈到的登录文件分析功能.具有相关性的主 ...

  6. sql语句_分页查询

    1.查询数据库中存在某一列名的表 use [db] go SELECT name FROM sysobjects WHERE id IN (SELECT id FROM syscolumns WHER ...

  7. XidianOJ 1020 ACMer去刷题吧

    题目描述 刷题是每个ACMer必由之路,已知某oj上有n个题目,第i个题目小X能做对的概率为Pi(0<=Pi<=1,1<=i<=n) 求小X至少做对k道题的概率 输入 第一行输 ...

  8. SQL Server 的表数据简单操作

    --表数据操作----添加表数据----向现有表添加数据--[use 要操作数据表的数据库名称go]insert [into] 数据表 [(字段名1,字段名2,字段名3, ...)] values(值 ...

  9. All About Python

    Part one: Learn the Basics Hello, World! print "Hello,World!" Variables and Types Python i ...

  10. CLASSIC VS INTERGRATED IN IIS 7.0

    Classic mode (the only mode in IIS6 and below) is a mode where IIS only works with ISAPI extensions ...