プレーンな HTML に多くの送信ボタンがあります。機能していないものは以下のとおりです:-他のものは以下と同じです
< form:submit cssClass="action-button" name="excelBTNX" value="Excel" id="excelBTNX" />
コントローラーの上記のボタンの機能は、Excel シートを作成してセッションに入れ (Cookie からダウンロードできます)、戻ることです。
Controller での対応するメソッドの定義は、正常に動作している他のボタンと同じです。
これの問題は、偶数ヒットでのみ機能することです。初めてクリックすると、ページが更新されます。もう一度クリックすると、コントロールがコントローラーに渡され、Excel が Cookie として表示されます。
javaScriptコードを使用して、送信が機能しているかどうかを追跡しようとしました
$('フォーム').submit(関数(){ alert("発生するイベント"); });
両方のケースでアラートを出します。
コントローラーからの検証部分を(手動で)行ったので、ローカルの組み込みバリデーターは使用されません。ですから、そうではないと思います。
どうすれば修正できますか?
コントローラーコード:-
@RequestMapping(value = "execute.action", method = RequestMethod.POST, params = "excelBTNX")
public String excelOut(HttpServletRequest request, HttpServletResponse response,
@ModelAttribute("mymodel") myModel model, BindingResult bindingResult, ModelMap modelmap) {
scr14(request).initializeSomeCalculation(model);// some innercalss called to manupulate model
HttpSession session = request.getSession(false);
if(1=1){//CRUD condition here true in READ mode.
model= new myModel ();
}
byte[] excel = createExcelS14(model,request);
String fileName = getExcelName() + ".xls";
String filepath = myFrameWorkUtils.createTempFile(excel, fileName);
if (session != null) {
session.setAttribute(fileDownload, filepath);
}
scr14(request).initializeSomeCalculation(model);
model.setDate(somedate);
return "myPanel";}