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= ...
随机推荐
- hdu 3415"Max Sum of Max-K-sub-sequence"(单调队列)
传送门 题意: 给出一个有 N 个数字([-1000 , 1000],N ≤ 105)的环状序列: 让你求一个和最大的连续子序列,并记录起始点. 要求这个连续子序列的长度小于等于K,加和相同的不同区间 ...
- BSGS与exBSGS学习笔记
\(BSGS\)用于解决这样一类问题: 求解\(A^x ≡B(modP)\)的最小\(x\),其中\(P\)为质数. 这里我们采用分块的方法,把\(x\)分解为\(i *t-b\)(其中\(t\)是分 ...
- C#设计模式 —— 依赖注入
在说依赖注入之前,先了解下什么是接口. 接口的相关规则: 1. 接口是一个引用类型,通过接口可以实现多重继承. 2. C#中接口的成员不能有new.public.protected.internal. ...
- Linux系统中/etc/rc.local和/etc/rc.d/rc.local的区别
/etc/rc.d/rc.local 用于添加开机启动命令 /etc/rc.local是/etc/rc.d/rc.local的软连接
- saltstack pillar
piller组件定义与客户端相关的任何数据(定义在master端),定义好的数据可以被其他组件调用(如state,api) 说通俗了,一句话,就是ansible vars里定义的变量,可以在整个pla ...
- 网络设备监控-Catic添加H3C的监控图解
网络设备监控-Catic添加H3C的监控图解 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 首先,我要声明满足2个条件才能作本篇笔记的操作:第一:你得有台cacti服务器,第二 ...
- JSON与XML之间的转换
public class JsonTest { private final Logger cLogger = Logger.getLogger(getClass()); /** * XML转JSON ...
- springBootJpa的复杂查询
分页 /** * 条件查询+分页 * @param whereMap * @param page * @param size * @return */ public Page<CaseManag ...
- linq总结系列(一)---基础部分
一.linq的基本概念 LINQ是C#和VB中的统一查询语法,使用对象来保存和检索来自不同来源(如数据库.xml.对象集合)的数据. 主要功能:消除了编程语言和数据库之间的不匹配,以及为不同类型的数据 ...
- Ado.NET基础必备
一.SqlConnection对象 第一次需要连接数据库时要和服务器握手,解析连接字符串,授权,约束的检查等等操作,而物理连接建立后,这些操作就不会去做了(默认使用了连接池技术). SqlConnec ...
转载▼