Controller层
@RequestMapping("/view")
public String view(KokyakuForm form, RedirectAttributes ra, Model model) {
return "/kokyakuSearch";
}
@RequestMapping("/kokyakuSearch")
public String kokyakuList(KokyakuForm form, RedirectAttributes ra,HttpServletRequest request) {
List<MKokyakuTbl> list = kokyakuSearchService.searchKokyakuForm(form.getKokyakuCdFrom(),form.getKokyakuCdTo(),form.getKokyakuNm());
int count = list.size();
ra.addFlashAttribute("size",count);
ra.addFlashAttribute("kokyaku",list);
System.out.println(list);
return "redirect:/view";
}
前端
<body onload="hideHistory('0')">
<form method="post" th:action="@{/kokyakuSearch}" th:object="${kokyakuForm}">
<span class="fontTitle">顧客検索</span>
<hr class="hrPopup1">
<div id="err" class="fontError">該当するデータがありません。</div>
<hr class="hrPopup1">
<fieldset class="windowWidth1x1">
<legend>検索条件</legend>
<table>
<tr>
<td><div class="item1 itemWidth0">顧客名</div></td>
<td colspan="2"><input type="text" class="input1 inputWidth2" th:value="*{kokyakuNm}" th:field="*{kokyakuNm}"></td>
</tr>
<tr>
<td><div class="item1 itemWidth0">顧客コード</div></td>
<td>
<input type="text" class="input1 inputWidth000" name="kokyakuCdFrom" th:value="*{kokyakuCdFrom}" th:field="*{kokyakuCdFrom}">
~
<input type="text" class="input1 inputWidth000" name="kokyakuCdTo" th:value="*{kokyakuCdTo}" th:field="*{kokyakuCdTo}">
</td>
<td><button class="button btnWidth2" onclick="showHistory('1')">検索(<span class="accessLetter">S</span>)</button></td>
</tr>
</table>
</fieldset>
<br>
<div id="result">
<fieldset class="windowWidth1x1" style="height:522px;">
<legend>検索結果</legend>
<div class="popupShowCnt">検索件数 <a id="size" th:text=${size}></a> 件</div>
<table class="listViewTable">
<tr>
<th class="item2" style="width:90px;"><u>顧客コード</u></th>
<th class="item2" style="width:517px;"><u>顧客名</u></th>
</tr>
</table>
<div class="scrollOnY" style="height:462px;">
<table class="listViewTable windowWidth1">
<tr th:each="list : ${kokyaku}">
<td style="width:90px;" nowrap th:text="${list.kokyakuCd}"></td>
<td style="width:490px;" nowrap th:text="${list.kokyakuNm}"></td>
</tr>
</table>
</div>
</fieldset>
</div>
<br>
<div class="windowWidth1x1 alignRight">
<button class="button btnWidth2" onclick="window.close();">閉じる (<span class=accessLetter>E</span>)</button>
</div>
</form>
</body>
showHistory('1')方法怎么写的