我有这个控制器方法的Spring MVC应用程序。
@RequestMapping(value = "/saveMe", method = RequestMethod.POST)
public @ResponseBody String saveMe(@RequestParam(value = "clientId") String strClientId,@RequestParam(value = "clientName") String strClientName,@RequestParam(value = "custBaseNo") String strCustBaseNo, @RequestParam(value = "category") String strCategory,@RequestParam(value = "clientCpt") String strClientCpt, @RequestParam(value = "pbk") String strPbk,@RequestParam(value = "prk") String strPrk,@RequestParam(value = "fileAct") int intFileAct, @RequestParam(value = "b2b") int intB2b,@RequestParam(value = "collection") int intCollection, @RequestParam(value = "primAccNo") String strPrimAccNo,@RequestParam(value = "accFromAcct") String strAccFromAcct,@RequestParam(value = "accToAcct") String strAccToAcct,@RequestParam(value = "intCount") int intCount,@RequestParam(value = "productId") String strProductId,HttpServletRequest request){
String strStatus ="";
System.out.println("strClientId is :::"+strClientId);
strStatus = sabService.saveDetails(strClientId,strClientName,strCustBaseNo,strCategory,strClientCpt,strPbk,strPrk,intFileAct,intB2b,intCollection,strPrimAccNo,strAccFromAcct,strAccToAcct,intCount,strProductId);
String[] strChkService = new String[intCount];
String[] strAccNO = new String[intCount];
int[] intTrnsLimit = new int[intCount];
String[] strProtcl = new String[intCount];
for(int j=1;j<=intCount;j++){
strChkService[j] = request.getParameter("chkService"+j)==null?"":request.getParameter("chkService"+j);
strAccNO[j] = request.getParameter("accountNo"+j)==null?"":request.getParameter("accountNo"+j);
intTrnsLimit[j] = Integer.parseInt(request.getParameter("transactionLimit"+j)==null?"0":request.getParameter("transactionLimit"+j));
strProtcl[j] = request.getParameter("protocol"+j)==null?"":request.getParameter("protocol"+j);
strStatus = sabService.saveServices(strClientId,strProductId,strChkService[j],strAccNO[j],intTrnsLimit[j], strProtcl[j] );
}
return "success";
}
提交表单时我收到此错误。
HTTP Status 400 - Required String parameter 'clientId' is not present
任何人都可以帮助我...提前致谢...
jquery-
$("#client-maint-form").attr("action","sabb/saveMe");
$("#client-maint-form").submit();
形式 -
<form id="client-maint-form" class="form-horizontal" enctype="multipart/form-data" method="POST">
我也试过GET ......但是得到了这个错误 HTTP状态405 - 不支持请求方法'GET'
这是表格
<form id="client-maint-form" class="form-horizontal" enctype="multipart/form-data" method="POST">
<div class="box-body">
<div class="form-group">
<label for="client-id" class="col-sm-3 control-label">Client Id<a style="color: red">*</a></label>
<div class="col-xs-4">
<input class="form-control" name="clientId" id="client-id" required="true" placeholder="Client Id" type="text">
</div>
</div>
<div class="form-group" id="password-div-add-update">
<label for="client-name" class="col-sm-3 control-label">Client Name<a style="color: red">*</a></label>
<div class="col-xs-4">
<input class="form-control" name="clientName" id="client-name" required="true" placeholder="Client Name" type="text">
</div>
</div>
</form>