一、必须将项目打包成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. 关于 JavaScript prototype __proto__ 一点总结

    http://www.cnblogs.com/wbin91/p/5265163.html 先上代码 function(y) Foo{ this.y = y;} Foo.prototype.x = 10 ...

  2. NHibernate系列文章二十五:NHibernate查询之Query Over查询(附程序下载)

    摘要 这一篇文章介绍在NHibernate 3.2里引入的Query Over查询,Query Over查询跟Criteria查询类似.首先创建IQueryOver对象,然后通过调用该对象的API函数 ...

  3. ue4 c++ 接口

    使用UE4接口比起普通的高级语言,要多做很多工作,是因为要兼容蓝图的使用,有一些小坑需要注意,开始吧. 1.新建接口类 打开UE4编辑器,与往常一样,新建C++类,然后选择Object继承,然后取名字 ...

  4. mysql 忘记root 密码的解决方法

    LINUX 1.切换root 用户 2.停止mysqld 服务 /etc/inid.d mysqld stop 3.跳过验证登录 mysqld_safe --skip-grant-tables &am ...

  5. Javascript垃圾回收机制(学习笔记)

    1,javascript具有自动的垃圾回收机制,自动内存的分配和无用内存的回收都可以自动管理.垃圾回收器周期性的执行: 2,Javascript的垃圾回收策略分为:引用计数和标记清除: 2.1 标记清 ...

  6. LCC

    LCC: super vector:

  7. thinkphp修改及编写标签库,编辑器的使用

    在view目录下创建Index_aaa.html <!DOCTYPE html> <html> <head> <meta charset="UTF- ...

  8. C#字符串(截取)

    1.按照逗号进行截取,并存放在一个数组中 eq:截取字符串,并放在数组中:string[] strArray = strPaths.Split(','); 获取某一个值 string s1=strAr ...

  9. HDOJ(2056)&HDOJ(1086)

    Rectangles    HDOJ(2056) http://acm.hdu.edu.cn/showproblem.php?pid=2056 题目描述:给2条线段,分别构成2个矩形,求2个矩形相交面 ...

  10. love easily fade

      Ubuntu addict and loving it , the answerer 's intro attracted me.When I first read a book on linux ...