SpringBoot+Thymeleaf+iView
SpringBoot+Thymeleaf参考:
https://www.cnblogs.com/kibana/p/10236187.html
1、Controller:
package cn.mmweikt.es.controller;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
public class IndexController {
@GetMapping("/index")
public String indexPage(Model model) {
model.addAttribute("name", "es_project.");
return "index";
}
@GetMapping("/vueResource")
@ResponseBody
public String vueResource() {
return "Hello vue-resource.";
}
}
2、index.html:
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>Title</title>
<!-- import stylesheet -->
<link rel="stylesheet" type="text/css" th:href="@{http://unpkg.com/iview/dist/styles/iview.css}">
<!-- import Vue.js -->
<script type="text/javascript" th:src="@{http://vuejs.org/js/vue.min.js}"></script>
<!-- import iView -->
<script type="text/javascript" th:src="@{http://unpkg.com/iview/dist/iview.min.js}"></script>
<!-- import vue-resource -->
<script th:src="@{https://cdn.jsdelivr.net/npm/vue-resource@1.5.1}"></script>
</head>
<body>
<div>
<span th:text="${name}"></span>
</div>
<div id="app">
<i-button @click="show">Click me!</i-button>
<Modal v-model="visible" title="Welcome">{{text}}</Modal>
</div>
<script>
new Vue({
el: '#app',
data: {
visible: false,
text: "Welcome to iView!"
},
methods: {
show: function () {
this.visible = true;
this.$http.get('/vueResource').then(function (response) {
this.text = response.bodyText;
});
}
}
})
</script>
</body>
</html>
3、效果:
SpringBoot+Thymeleaf+iView的更多相关文章
- org.springframework.expression.spel.SpelEvaluationException: EL1004E: Method call: Method service() cannot be found on com.my.blog.springboot.thymeleaf.util.MethodTest type
前言 本文中提到的解决方案,源码地址在:springboot-thymeleaf,希望可以帮你解决问题. 至于为什么已经写了一篇文章thymeleaf模板引擎调用java类中的方法,又多此一举的单独整 ...
- springboot+thymeleaf+pageHelper带条件分页查询
html层 <div> <a class="num"><b th:text="'共 '+ ${result.resultMap['pages ...
- springboot+thymeleaf简单使用
关于springboot想必很多人都在使用,由于公司项目一直使用的是SpringMVC,所以自己抽空体验了一下springboot的简单使用. 环境搭建 springbooot的环境搭建可以说很灵活, ...
- SpringBoot thymeleaf使用方法,thymeleaf模板迭代
SpringBoot thymeleaf使用方法,thymeleaf模板迭代 SpringBoot thymeleaf 循环List.Map ============================= ...
- SpringBoot thymeleaf模板页面没提示,SpringBoot thymeleaf模板插件安装
SpringBoot thymeleaf模板插件安装 SpringBoot thymeleaf模板Html页面没提示 SpringBoot thymeleaf模板页面没提示 SpringBoot t ...
- SpringBoot thymeleaf模板版本,thymeleaf模板更换版本
SpringBoot thymeleaf模板版本 thymeleaf模板更换版本 修改thymeleaf模板版本 ================================ ©Copyright ...
- Springboot+Thymeleaf框架的button错误
---恢复内容开始--- 在做公司项目时,遇到了一个Springboot+Thymeleaf框架问题: 使用框架写网站时,没有标明type类型的button默认成了‘submit’类型,每次点击按钮都 ...
- layui表格数据渲染SpringBoot+Thymeleaf返回的数据时报错(Caused by: org.attoparser.ParseException: Could not parse as expression: ")
layui table渲染数据时报错(Caused by: org.attoparser.ParseException: Could not parse as expression: ") ...
- 不要再学 JSP 了,学 SpringBoot + Thymeleaf + Vue吧
老读者就请肆无忌惮地点赞吧,微信搜索[沉默王二]关注这个在九朝古都洛阳苟且偷生的程序员.本文 GitHub github.com/itwanger 已收录,里面还有我精心为你准备的一线大厂面试题. 读 ...
随机推荐
- tensorflow队列tf.FIFOQueue | enqueue | enqueue_many | dequeue | dequeue_many
关于队列的相关知识,盗用一张https://blog.csdn.net/HowardWood/article/details/79406891的动态图 import tensorflow as tf ...
- UVA1629_Cake slicing
Cake slicing 给你一个矩形大小,和每个樱桃的坐标,现在让你去切使得切之后的小矩形包含一个樱桃,每次切的代价是切痕的长度,问你最小代价是多少 思路: 首先要明白一点,不能切除一个不含樱桃的矩 ...
- Cocos2d-x之数据的处理
| 版权声明:本文为博主原创文章,未经博主允许不得转载. FileUtils 在游戏中,用户要保存自己的偏好设置和玩家的信息,都需要涉及到游戏数据的处理.首先要想处理数据,则要找到文件,创建文件, ...
- VINS 回环检测与全局优化
回环检测 VINS回环检测与全局优化都在pose_graph.cpp内处理.首先在pose_graph_node加载vocabulary文件给BriefDatabase用,如果要加载地图,会loadP ...
- 小程序中为什么使用var that=this
前言: 在小程序或者js开发中,经常需要使用var that = this;开始我以为是无用功,(原谅我的无知),后来从面向对象的角度一想就明白了,下面简单解释一下我自己的理解,欢迎指正批评. 代码示 ...
- GeneXus笔记本—城市级联下拉
最近在交流GeneXus的时候 总是会遇到有城市级联下拉的问题 这里就简单做几种方式 供大家参考参考 第一种就是直接绑定关联信息然后在后者的条件模块设定条件即可 具体如下: 首先我们所需要的表为pro ...
- Codeforces 1188A 构造
题意:给你一颗树,树的边权都是偶数,并且边权各不相同.你可以选择树的两个叶子结点,并且把两个叶子结点之间的路径加上一个值(可以为负数),问是否可以通过这种操作构造出这颗树?如果可以,输出构造方案.初始 ...
- 从Flask-Script迁移到Flask-Cli
Abstrct flask从0.11版本开始引入了click提供命令行支持,在此之前我们通常会引入Flask-Script来提供. 在<Flask web开发>这本书编写时flask0.1 ...
- SSM框架搭建过程
引入依赖的jar包(pom.xml) a. <!--Spring SpringMVC相关--> spring-webmvc b. <!--Spring事务--> sprin ...
- 第07章 JdbcTemplate
第07章JdbcTemplate 1. 概述 为了使JDBC更加易于使用,Spring在JDBC API上定义了一个抽象层,以此建立一个JDBC存取框架. 作为Spring JDBC框架的核心,JDB ...