thymeleaf+SpringMVC 疑问解惑
问题描述:
controller 返回从DB查的数据List<obj>
假设该List里数据格式为
index0 A,1,2,3
index1 A,4,5,6
index2 A,7,8,9
index3 A,1,2,3
index4 B,10,11,12
index5 C,1,4,5
index6 D,1,2,3
页面预呈现
A
1 2 3
4 5 6
7 8 9
1 2 3
B
10 11 12
C
1 4 5
D
1 2 3
html代码如下:
该代码呈现出来结果是这样

想要的是这样:

描述: 已经知道 LIST里的数据是从DB里查出来的,而且有顺序,
根据model里的 字母ID(也就是上图的ABC) 把从属于他们的数据汇总到一起
在画面中 字母字段 独占 一行。 从下一行 的首个方格开始排列从属于它们的数据
使用模板:thymeleaf。 返回数据是呈现在<TBODY>标签里。循环在<TR>里循环。SQL文 controller 皆可改动。
希望赐教:
代码不在身边,明天可以附上代码,越详细越好,越简单越好。 求解药。
controller 返回从DB查的数据List<obj>
假设该List里数据格式为
index0 A,1,2,3
index1 A,4,5,6
index2 A,7,8,9
index3 A,1,2,3
index4 B,10,11,12
index5 C,1,4,5
index6 D,1,2,3
页面预呈现
A
1 2 3
4 5 6
7 8 9
1 2 3
B
10 11 12
C
1 4 5
D
1 2 3
html代码如下:
<tbody id="resultData" >
<tr th:each="result, stat : ${resultList}">
<td th:if="判定条件(業者の場合)" th:text="${result.companySearchName}"><input type="checkbox" class="check-row check-g1"></td><!--業者名 -->
<td th:if="判定条件(業者の場合)" th:text="${result.spec}"></td><!-- 仕様 -->
<td th:if="判定条件(業者の場合)" th:text="${result.quantity}"></td><!-- 数量 -->
<td th:if="判定条件(業者の場合)" th:text="${result.quantityUnitName}"></td><!-- 単位 -->
<td th:if="判定条件(業者の場合)" class="right-position"><input type="text" class="no-border input-money-yen" th:text="${result.unitPriceBudget}" readonly></td><!-- 単価 -->
<td th:if="判定条件(業者の場合)" class="right-position"><input type="text" class="no-border input-money-yen" th:text="${result.amount}" readonly></td><!-- 金額 -->
<td th:if="判定条件(業者の場合)" th:text="${result.orderedFlag}"></td><!-- 発注済を非表示-->
<td th:if="判定条件(品目の場合)" class="check-row check-g1-row" ><input type="checkbox" class="check-all">[[${result.goodsName}]]</td><!-- 品名 -->
<td th:if="判定条件(品目の場合)" th:text="${result.spec}"></td><!-- 仕様 -->
<td th:if="判定条件(品目の場合)" th:text="${result.quantity}"></td><!-- 数量 -->
<td th:if="判定条件(品目の場合)" th:text="${result.quantityUnitName}"></td><!-- 単位 -->
<td th:if="判定条件(品目の場合)" class="right-position"><input type="text" class="no-border input-money-yen" th:text="${result.unitPriceBudget}" readonly></td><!-- 単価 -->
<td th:if="判定条件(品目の場合)" class="right-position"><input type="text" class="no-border input-money-yen" th:text="${result.amount}" readonly></td><!-- 金額 -->
<td th:if="判定条件(品目の場合)" th:text="${result.orderedFlag}"></td><!-- 発注済を非表示-->
</tr>
</tbody> 该代码呈现出来结果是这样

想要的是这样:

描述: 已经知道 LIST里的数据是从DB里查出来的,而且有顺序,
根据model里的 字母ID(也就是上图的ABC) 把从属于他们的数据汇总到一起
在画面中 字母字段 独占 一行。 从下一行 的首个方格开始排列从属于它们的数据
使用模板:thymeleaf。 返回数据是呈现在<TBODY>标签里。循环在<TR>里循环。SQL文 controller 皆可改动。
希望赐教:
代码不在身边,明天可以附上代码,越详细越好,越简单越好。 求解药。
...全文
相关推荐
spring+springmvc+mybatis+thymeleaf练习demo项目源码
spring+springmvc+mybatis+thymeleaf 框架组合练习学习做的一个完整的精简的小demo项目源码
SpringMVC+Mysql实例详解
SpringMVC+Mysql实例详解,一直用的是ssh,因为公司要用到SpringMVC,以前也没接触过,所以今天来和大家一起学习一下这个框架,分享一下。
spring+springmvc+jpa+thymeleaf 练习demo项目源码
spring+springmvc+jpa+thymeleaf 框架组合练习学习做的一个完整的精简的小demo项目源码
SpringMVC中使用Thymeleaf模板引擎实例代码
主要介绍了SpringMVC中使用Thymeleaf模板引擎实例代码,分享了相关代码示例,小编觉得还是挺不错的,具有一定借鉴价值,需要的朋友可以参考下
Springboot Spring+SpringMVC+Mybatis+Thymeleaf3.0+Druid 框架
Springboot Spring+SpringMVC+Mybatis+Thymeleaf3.0+Druid 有增删改查,有监控http://localhost:8080/druid/login.html 账号 root 密码 123


Web 开发
