店舗番号付きの単純な選択があります。Excelを処理するには、選択した値をコントローラーに渡す必要があります。
空の値を渡し続けます
これが私のコードです:
<form>
<label>Select a Store</label>
<form:select id="store" name="store" path="storeList">
<form:option value="">ALL</form:option>
<form:options items="${storeList}" />
</form:select>
here<c:out value= "${store }"/>
<input type="hidden" name="store"/>
<a href="exportReportByStore.do?store=${store}" smButtonStyling">
<img src="/web/static/images/remove.png" /> Export to excel
</a>
</form>
私のコントローラー:
@RequestMapping(value = "exportReportByStore.do", method ={ RequestMethod.POST, RequestMethod.GET}, produces = "application/vnd.ms-excel")
public void exportReportByStore(final StoreSignForm form, final HttpServletResponse response, final HttpServletRequest request,
@RequestParam(value="store") final String store) {
LOG.debug("Store To export" + store);
List<StoreSign> signsList = storeSignService.getSignsByStore(store);
.......}
ストア値で直接リンクをヒットすると、コードは機能します。あなたがアドバイスしていただけますか?
リンクをボタンに変更し、マッピングをaction = /exportReportByStore.doに追加しました
<form action="exportReportByStore.do" method="post">
<label>Select a Store</label>
<form:select id="store" name="store" path="storeList" style="top: 0px;width: 111px; ">
<form:option value="">ALL</form:option>
<form:options items="${storeList}" />
</form:select>
<input type="hidden" name="store"/>
<input type="submit" value="Export" class="btnFwd gradient smButtonStyling">
</form>
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加