在Spring Controller中发布Div值

时间:2017-06-06 01:37:55

标签: java jquery spring

我正在为小型Java项目使用https://github.com/puikinsh/gentelella模板。部分原因是我使用日历范围选择,我无法将所选日期范围发送到Spring Controller类。下面的代码给了我一个日历,我可以选择值但是点击或提交我无法将值发送回我的控制器。你能帮忙吗?

JSP代码:

<form id="demo-form2" data-parsley-validate="" class="form-horizontal form-label-left"
   novalidate="" action="txnsummeryDetails">
   <div class="form-group">
      <label class="control-label col-md-3 col-sm-3 col-xs-12">Report Date
      Range</label>
      <div id="reportrange_right" class="pull-left"
         style="background: #fff; cursor: pointer; padding: 5px 10px; border: 1px solid #ccc">
         <i class="glyphicon glyphicon-calendar fa fa-calendar"></i>
         <span id="dateStr">May 4, 2017 - June 2, 2017</span> <b class="caret"></b>
      </div>
      &nbsp;&nbsp;&nbsp;<button onclick="function submitForm() {
         var MyDiv1 = document.getElementById('datatable-buttons');
         alert(MyDiv1);
         }
         submitForm()" class="btn btn-success">Submit</button>
   </div>
</form>

控制器代码:

@RequestMapping(value = "txnsummeryDetails", method = RequestMethod.GET)
    public ModelAndView txnSummeryFormHandler() {
        List<TransactionsSummary> txnDetails = transactionsSummaryService.getTxnDetails("28-05-17", "31-05-17");
        return new ModelAndView("txnSummery", "txnDetails", txnDetails);
    }

0 个答案:

没有答案