一、必须将项目打包成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. Broadcom有线网卡在Windows 8/8.1/10下使用系统自带驱动会断网的解决办法

    出处:qiuyi21.cnblogs.com 1.下载最新正式版驱动程序 上Broadcom官方网站http://www.broadcom.com/support/ethernet_nic/downl ...

  2. MVC中的Html.Partial和Html.RenderPartial

    Partial辅助方法用于将部分视图渲染成字符串.注意没必要为视图指定路径和文件扩展名,因为运行时定位部分视图与定位正常视图使用的逻辑相同.例如,下面代码就渲染一个名为AlbumDisplay的部分视 ...

  3. leetcode6:Zigzag Conversion@Python

    The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like ...

  4. Flex使用Blazeds与Java交互及自定义对象转换详解-DATAGRID读取ORACLE数据

    http://www.cnblogs.com/RocD-DuPeng/articles/1751040.html 一.建立Flex与Java交互的工程. 本文中讲到的交互是利用Blazeds的,因为这 ...

  5. javascript Windouw 转自 http://www.cnblogs.com/kissdodog/archive/2013/01/01/2841464.html

    javascript之window对象 window :window对象是BOM中所有对象的核心,除了是BOM中所有对象的父对象外,还包含一些窗口控制函数. 1.全局的window对象 JavaScr ...

  6. python types模块

    types模块成员: ['BooleanType', 'BufferType', 'BuiltinFunctionType', 'BuiltinMethodType', 'ClassType', 'C ...

  7. 账号控管:NIS服务器

    NIS服务器   sun最开始命名为 Yellow pages ,黄页, NIS = YP;   14.1 NIS的由来与功能   NIS--Network information services( ...

  8. IDL中的HRESULT值

    IDL中的HRESULT值

  9. 【232】◀▶ IDL显示地理图像

    参考: 01   IMAGE 将图像数据以图形窗体的形式显示. 02   COLORBAR 在已经存在的IDL图形中增加一个colorbar或创建. 03   MAPGRID 在已经存在的IDL地图图 ...

  10. Google V8编程详解(序)Cloud App

    此系列文章转载于此http://blog.csdn.net/feiyinzilgd/article/details/8247723          应用程序发展到今天,应用程序的概念也在不断地发生着 ...