Thymeleaf--:fragment
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:th="http://www.thymeleaf.org">
<body>
<div th:fragment="crudmodal"> //主要是这里
<!-- modify modal -->
<div class="modal fade" id="crudmodal_modify" tabindex="-1"
role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:th="http://www.thymeleaf.org">
<body>
<!-- crudmodal -->
<!-- add modal -->
<div th:fragment="crudmodal"> <!-- modify modal -->
<div class="modal fade" id="crudmodal_modify" tabindex="-1"
role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div style="width: 900px;" class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-hidden="true">×</button>
<h4 id="modaltitle" class="modal-title">送检人员</h4>
</div>
<div class="modal-body">
<div class="panel panel-default">
<form class="form-horizontal" style="width: 60%;"> <div class="form-group">
<div class="col-sm-2 control-label">姓名</div>
<div class="col-sm-10">
<input id="xingMing" type="text" class="form-control"
placeholder="姓名" />
</div>
</div>
<div class="form-group">
<div class="col-sm-2 control-label">性别</div>
<div class="col-sm-10">
<select class="col-sm-10 form-control" id="xbSelect"
style="float: left;">
<option value="男">男</option>
<option value="女">女</option>
</select>
</div>
</div>
<div class="form-group">
<div class="col-sm-2 control-label">身份证号码</div>
<div class="col-sm-10">
<input id="shenFenZhengHaoMa" type="text" class="form-control"
placeholder="身份证号码" />
</div>
</div> <div class="form-group">
<div class="col-sm-2 control-label">电话号码</div>
<div class="col-sm-10">
<input id="dianHuaHaoMa" type="text" class="form-control"
placeholder="电话号码" />
</div>
</div>
<!-- <div class="form-group">
<div class="col-sm-2 control-label">地区</div>
<div class="col-sm-10">
<input id="quYuMingCheng" type="text" class="form-control"
placeholder="地区" />
</div>
</div> -->
<div class="form-group">
<div class="col-sm-2 control-label">区域</div>
<div class="col-sm-10">
<select class="form-control" id="quyuSelect">
<option th:each="quyuguanli:${quyuguanlis}"
th:value="${quyuguanli.id}"
th:text="${quyuguanli.quYuMingCheng}"
th:attr="phone=${quyuguanli.quYuBianMa}"></option>
</select>
</div>
</div>
<!-- <div class="form-group">
<div class="col-sm-2 control-label">人员状态ID</div>
<div class="col-sm-10">
<input id="renYuanZhuangTaiId" type="text"
class="form-control" placeholder="人员状态ID" />
</div>
</div> -->
<div class="form-group">
<div class="col-sm-2 control-label">人员状态</div>
<div class="col-sm-10">
<select class="form-control" id="ryztSelect">
<option th:each="ryztadd:${renyuanzhuangtais}"
th:value="${ryztadd.renYuanZhuangTaiId}"
th:text="${ryztadd.renYuanZhuangTai}"></option>
</select>
</div>
</div>
</form>
</div> </div>
<div class="modal-footer">
<button type="button" class="btn btn-default"
data-dismiss="modal">取消</button>
<button type="button" class="btn btn-primary" data-dismiss="modal"
modifyid="" AddorModify="" onclick="addorModifySubmit(this);">是</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal -->
</div> <!-- delete modal -->
<div class="modal fade" id="crudmodal_delete" tabindex="-1"
role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-hidden="true">×</button>
<h4 class="modal-title">作废订单</h4>
</div>
<div class="modal-body">是否确定作废该订单吗?</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">否
</button>
<button type="button" class="btn btn-primary" data-dismiss="modal"
deleteid="0" onclick="delSubmit(this);">是</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal -->
</div> <!-- operation result modal -->
<div class="modal fade" id="crudmodal_result" tabindex="-1"
role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-hidden="true">×</button>
<h4 class="modal-title">操作结果</h4>
</div>
<div id="crudmodal_result_operateResult" class="modal-body"> </div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal"
onclick="refresh();">确定</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal -->
</div> <!-- loading modal-->
<div class="modal fade" id="crudmodal_loading" tabindex="-1"
role="dialog" aria-labelledby="myModalLabel" data-backdrop='static'>
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">提示</h4>
</div>
<div class="modal-body">请稍候。。。</div>
</div>
</div>
</div> </div> </body>
</html>
完整版
function initModifyModal(obj) {
jQuery.ajax({
url: '/sjr/' + $(obj).attr('whatever'),
type: 'GET',
beforeSend: function () {
$('#crudmodal_loading').modal('show'); 弹出对应的界面块
},
error: function (request) {
$('#crudmodal_loading').modal('hide');
$('#crudmodal_result #crudmodal_result_operateResult').html('操作失败');
$('#crudmodal_result').modal('show');
},
success: function (data) {
if (data.code == 200) {
$('#crudmodal_loading').modal('hide');
$('#crudmodal_modify #xbSelect').val(data.data.xingBie);
$('#crudmodal_modify .btn-primary').attr('AddorModify',2); //1是添加 2 修改
$('#crudmodal_modify .btn-primary').html("修改");
$('#crudmodal_modify #modaltitle').html("送检人员-修改");
$('#crudmodal_modify').modal('show');
} else {
$('#crudmodal_loading').modal('hide');
$('#crudmodal_result #crudmodal_result_operateResult').html('操作失败:' + data.code);
$('#crudmodal_result').modal('show');
}
}
});
}
但是网上很多网友的做法不是这样的,
---------以下都看不懂
thymeleaf中fragment 的layout布局 - CSDN博客
http://blog.csdn.net/shanshan_blog/article/details/65630607
=========
<</span>div th:include="common/test:: test2(value1,value2)"></</span>div>
<</span>div th:fragment="test2(valueOne,valueTwo)">
Thymeleaf--:fragment的更多相关文章
- Thymeleaf+Spring整合
前言 这个教程介绍了Thymeleaf与Spring框架的集成,特别是SpringMvc框架. 注意Thymeleaf支持同Spring框架的3.和4.版本的集成,但是这两个版本的支持是封装在thym ...
- spring+thymeleaf实现表单验证数据双向绑定
前言 这个教程介绍了Thymeleaf与Spring框架的集成,特别是SpringMvc框架. 注意Thymeleaf支持同Spring框架的3.和4.版本的集成,但是这两个版本的支持是封装在thym ...
- Thymeleaf模板引擎+Spring整合使用方式的介绍
尊重原创,原文地址为:https://www.cnblogs.com/jiangchao226/p/5937458.html 前言 这个教程介绍了Thymeleaf与Spring框架的集成,特别是Sp ...
- spring-security doc logout
18.5.3 Logging Out Adding CSRF will update the LogoutFilter to only use HTTP POST. This ensures that ...
- thymeleaf之fragment
MUEAS项目,web前端采用thymeleaf作为展示层.这个view解析器,个人觉得非常不错.简单而且性能也比较好!个人觉得比JSP和freemarker之类,简单易用! 今天简单记录一下frag ...
- thymeleaf的fragment例子
fragment介绍 fragment类似于JSP的tag,在html中文件中,可以将多个地方出现的元素块用fragment包起来使用. 定义fragment 新建foot.html文件 <!D ...
- spring boot:thymeleaf给fragment传递参数的方法(spring boot 2.3.3)
一,thymeleaf如何给fragment传递参数? 1,如果是全局的参数,可以用interceptor中传递 非全局参数,可以从controller中传递 2,引用片断时也可以传递参数 说明:刘宏 ...
- spring boot:thymeleaf模板中insert/include/replace三种引用fragment方式的区别(spring boot 2.3.3)
一,thymeleaf模板中insert/include/replace三种引用fragment方式的区别 insert: 把整个fragment(包括fragment的节点tag)插入到当前节点内部 ...
- spring boot(四):thymeleaf使用详解
在上篇文章springboot(二):web综合开发中简单介绍了一下thymeleaf,这篇文章将更加全面详细的介绍thymeleaf的使用.thymeleaf 是新一代的模板引擎,在spring4. ...
- Thymeleaf
1.在html顶部添加 <html xmlns:th="http://www.thymeleaf.org"> 2.url表达式 @{...} <link rel= ...
随机推荐
- JDK几个高版本的新特性
JDK 高版本的新特性 1.JDK5的新特性: 自动拆装箱 见Integer部分笔记 泛型 增强for循环 静态导入 可变参数 见集合部分笔记 枚举 是指将变量的值一一列出来,变量的值只限于列举出来的 ...
- errorC2504未定义基类
这一般是在有继承时,头文件引用错误 例如: A.cpp文件 A .h文件 #include ...
- noi.openjudge 1.12.6
http://noi.openjudge.cn/ch0112/06/ 总时间限制: 2000ms 内存限制: 65536kB 描述 传说很遥远的藏宝楼顶层藏着诱人的宝藏.小明历尽千辛万苦终于找到传 ...
- php5.4后htmlspecialchars输出为空的问题
从旧版升级到php5.4,恐怕最麻烦的就是htmlspecialchars这个问题了!当然,htmlentities也会受影响,不过,对于中文站来说一般用htmlspecialchars比较常见,ht ...
- Java的一些基本术语
1. 反射 获取类本身,就叫“反射”,有以下3种方式: // 通过“实例”获取类 String str = "hello"; Class cls1 = str.getClass() ...
- 字符设备驱动(六)按键poll机制
title: 字符设备驱动(六)按键poll机制 tags: linux date: 2018-11-23 18:57:40 toc: true --- 字符设备驱动(六)按键poll机制 引入 在字 ...
- kubernetes 基础一
从集群外部访问pod或service pod 在Kubernetes中,创建.调度和管理的最小单位是pod而不是容器.pod代表着一个运行着的工作单元.一般情况下,每个pod中只有一个容器(原因是为了 ...
- 利用 JMetal 实现大规模聚类问题的研究(一)JMetal配置
研究多目标优化问题,往往需要做实验来对比效果,所以需要很多多目标方面的经典代码,比如NSGA-II, SPEA, MOEA,MOEA/D, 或者PSO等等. 想亲自实现这些代码,非常浪费时间,还有可能 ...
- JAVA核心技术I---JAVA基础知识(常量设计和常量池)
一:常量---一种不会修改的变量 –Java没有constant关键字 –不能修改,final –不会修改/只读/只要一份,static –方便访问publicJava中的常量 –public sta ...
- spring整合curator实现分布式锁
为什么要有分布式锁? 比如说,我们要下单,分为两个操作,下单成功(订单服务),扣减库存(商品服务).如果没有锁的话,同时两个请求进来.先检查有没有库存,一看都有,然后下订单,减库存.这时候肯定会出现错 ...
转载▼