The request sent by the client was syntactically incorrect.(轉載)
阿新 • • 發佈:2017-05-20
gif div button btn brief submit label rect method
這個錯誤是SpringMVC報出來的,見到它意味著html/jsp頁面的控件名稱 和 controller裏函數的參數不符。
好比界面有個這樣的form
<form name="form1" action="uploadDocument.html" method="post" ENCTYPE="multipart/form-data"> <div class="form" > <p> <span class="req"><input id="remarkTxt" name="remarkTxt" class="field size4" title="Enter the date" /></span> <label>Remark: <span>(The brief introduction of the file)</span></label> </p> <p> <span class="req"><input type="file" name="uploadFileCtrl" class="field size4" title="Choose the file" /></span> <label>Upload file: <span>(Click browse to choose)</span></label> </p> </div> <div class="buttons"> <input id="queryBtn" type="button" class="button" value="Submit" /> </div> </form>
而對應的函數參數應該這樣寫:
@RequestMapping(value="/uploadDocument") public String uploadDocument( @RequestParam("remarkTxt") String remark, @RequestParam("uploadFileCtrl") MultipartFile file,
HttpServletRequest request,
HttpServletResponse response){
....
}
}
註意上述粗體字的一一對應關系。
分類: Spring,Java Web應用開發The request sent by the client was syntactically incorrect.(轉載)