HTML页面显示搜索结果。点击Mass update按钮,我需要将搜索结果(searchList
)传递给控制器。任何人都可以帮助如何将整个搜索结果传递给控制器?结果是类型List<Map<String, Object>>
如何将搜索结果传递到控制器
HTML代码:
<div id="resultstabJoin" th:if="!${#lists.isEmpty(searchList)}">
<table class="tg" id="results" style="width: 100%">
<thead>
<tr>
<th class="">Person #</th>
<th class="">Creator</th>
<th class="">Valid From</th>
<th class="">Valid To</th>
<th class="">Effective From</th>
<th class="">Expiry</th>
</tr>
</thead>
<tbody>
<tr th:each="map : ${searchList}">
<td class="tg bg"><a th:id="${map['PERSON_ID']}" style="cursor: pointer;"
th:text="${map['PERSON_ID']}"
th:onclick="'javascript:viewActionURL(\'' + @{../searchController/__${map['PERSON_ID']}__} + '\')'"></a></td>
<td class="tg bg" th:text="${map['CREATED_BY']}"></td>
<td class="tg bg" th:text="${map['VALID_FROM']}"></td>
<td class="tg bg" th:text="${map['VALID_TO']}"></td>
<td class="tg bg" th:text="${map['COMMENCEMENT_DT']}"></td>
<td class="tg bg" th:text="${map['EXPIRY_DT']}"></td>
</tr>
</tbody>
</table>
<div class="row" align="right" style="width: 100%; margin-top: 10px;">
<input type="button" value="Mass Update" class="btn btn-primary" id="massUpdate" th:onclick="'javascript:muActionURL(\'' + @{/searchController/massUpdate} + '\')'"/>
</div>
</div>
Thankyou的答复。对不起。我不明白。我可以请你详细解释一下。谢谢。 –
问题是,搜索结果将显示在搜索按钮上。但稍后,当点击大量更新按钮时,搜索结果将消失。我需要保留结果表。根据代码,搜索按钮操作进入到控制器的'/ search'映射,并且批量更新按钮单击重定向到控制器的'/ massupdate'映射。结果实际上是从DB中提取的,并在modelAttribute中设置,它是句柄,并在'/ search'中设置 –