参考:springboot配置跳转html页面

1,首先在pom文件中引入模板引擎jar包

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
2,在application.properties中配置模板引擎

spring.thymeleaf.prefix=classpath:/templates/

3,在templates下建立login.html文件


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<title>Title</title>
</head>
<body>
<h1>1314314141</h1>
</body>
</html>

4,写controller


package com.example;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; /**
* Created by hzm on 2017/4/1.
*/
@Controller
public class HelloController { @RequestMapping("/test")
public String test(){
return "login";
}
}
5输入网址
http://localhost:8080/test

6页面会出现

1314314141

SpringBoot 使用Thymeleaf解决静态页面跳转问题的更多相关文章

  1. Spring Boot 静态页面跳转

    本篇博客仅为自己提个醒:如何跳转页面而不麻烦控制器. 当我们创建 Spring Boot 项目时(勾选了 Thymeleaf 和 Web),目录结构会是如下:        其中图二是我创建了一个 h ...

  2. js实现静态页面跳转传参

    最近有个项目: 存静态web服务,一个新闻页面列表出所有新闻摘要信息,然后通过点击新闻详情访问到该新闻的详情页面: 新闻展示的页面通过ajax请求接口获取到新闻的摘要信息,预计想通过id的方式访问到新 ...

  3. SpringBoot 利用freemaker生成静态页面

    1. <!-- freemarker模板 --> <dependency> <groupId>org.springframework.boot</groupI ...

  4. Vue解决同一页面跳转页面不更新

    问题分析:路由之间的切换,其实就是组件之间的切换,不是真正的页面切换.这也会导致一个问题,就是引用相同组件的时候,会导致该组件无法更新. 方案一:使用 watch 进行监听 watch: { /* = ...

  5. springboot整合thymeleaf——引用静态资源

    原html src="/css/index.css" thymeleaf中,th:src="@{/css/index.css}"

  6. SpringBoot系列——Thymeleaf模板

    前言 thymeleaf是springboot官方推荐使用的java模板引擎,在springboot的参考指南里的第28.1.10 Template Engines中介绍并推荐使用thymeleaf, ...

  7. springboot整合Thymeleaf模板引擎

    引入依赖 需要引入Spring Boot的Thymeleaf启动器依赖. <dependency> <groupId>org.springframework.boot</ ...

  8. 解决SpringBoot页面跳转无法访问静态资源的问题

    初学SpringBoot,写项目的时候遇到了问题,原本的页面是这样的 但启动项目后是这样的 这是因为thymeleaf中引入静态资源及模板需要使用到 th:xxx 属性,否则无法在动态资源中访问静态资 ...

  9. SpringBoot 结合 Thymeleaf 进行页面的跳转

    1.引入thymeleaf依赖 <!--thymeleaf--> <dependency> <groupId>org.springframework.boot< ...

随机推荐

  1. 【OJ】字符串去重并并按原顺序打印出重复字符

    ACM上一道简单的字符串题,从网上找了下类似的代码进行参考外加之个人思考,想到此好思路. 题目大意 任意输入一行字符串,检索重复出现的字符.将原字符串中的重复字符删除后按照原顺序输出,同时按照原顺序输 ...

  2. java中List,Set,Map用法以及区别

    List,Set,Map是否继承自Collection接口? 答:List,Set是,Map不是. Collection是最基本的集合接口,一个Collection代表一组Object,即Collec ...

  3. 提高R语言速度--转载

    1.     参考<R语言编程艺术>(Norman Matloff) chapter 14 & chapter 15 2.     方法 (1)向量化 与非向量化-循环做个对比: ...

  4. python 移动文件夹

    xxx@ddd:~$ mkdir testa testb >>> import shutil >>> shutil.move("/home/xxx/tes ...

  5. anaconda 安装包

    很多包在anaconda navigator里搜不到 如果为了在host编译opencv而在bashrc和profile里屏蔽了anaconda的路径,则 使用$HOME/anaconda3/bin/ ...

  6. 一次dropzone体验

    对于前端,本人不是太擅长,对于当前的一些网上的样例,也许是习武悟性太差,不是太透,所以只能通过blog的方式记录下一些武功套路,便于以后查询使用 首先,我们需要知道这个武功适应的战场. 什么是drop ...

  7. 提取出一个组装基因组的gap(N)和重复序列区域,保存为bed格式

    参见: Question: How to extract allnon-seqencedpositions from a genome (Fasta file)? test.fa >chr1 N ...

  8. gem "searchkick"(4500✨) 智能搜索(使用Elastic search)(Gorails:建立一个侧边搜索栏)

    Searchkick

  9. SSD: ReLU6

    1.在src\caffe\proto\caffe.proto中搜索message LayerParameter,在optional ReLUParameter relu_param = 123之后添加 ...

  10. 自定义Exception异常

    自定义异常构建 首先写一个自定义异常,继承Exception,代码如下 public class NoMappingParamString extends Exception { /*无参构造函数*/ ...