我为用餐订单系统编写代码。我有CheckOut的JSP来输入信息以检查订单是否已完成。我使用 DateTimePicker(javascript的库)来选择交付日期时间。首先,我选择现在的未来,然后我继续检查,这是工作。 但是当我选择现在的过去并继续检查时,我的hibernate验证是catch并重定向到同一页面。并且我尝试再次选择日期时间,但是我的脚本在我第一次选择的时候不一样。这是我的jsp
<h1>Check out: Please fill in your delivery information! </h1>
<form:form commandName="CheckoutDTO" action="Checkout"
method="post" class="form-horizontal"
onload="window.location.href=window.location.href">
<!-- onsubmit="return validateForm();" -->
<div class="form-group">
<label for="exampleInputEmail1">Name</label>
<form:input type="text" path="name" cssClass="form-control"
id="exampleInputEmail1" value="${cookie.customerName.value}" />
<form:errors path="name" cssClass="error" />
</div>
<div class="form-group">
<label for="exampleInputPassword1">Room No</label>
<form:input type="text" path="room_number"
cssClass="form-control" id="exampleInputPassword1"
value="${cookie.roomNumber.value}" />
<form:errors path="room_number" cssClass="error" />
</div>
<div class="form-group">
<label for="exampleSelectLocation">Delivery Location</label>
<form:select cssClass="form-control" path="delivery_code">
<c:forEach items="${deliveryList}" var="item">
<option value="${item.delivery_code}">${item.delivery_name}</option>
</c:forEach>
</form:select>
<form:errors path="delivery_code" cssClass="error" />
</div>
<div class="form-group">
<input type="checkbox" name="asap" id="asap" value="1"
onchange="chkAsapCheckChanged()" /> <label for="asap">As
soon as possible.</label>
</div>
<!-- DateTime Picker -->
<div class="form-group">
<label for="exampleSelectLocation">Delivery Date and
Time: </label>
<form:input type="text" path="delivery_time" id="dpDeliveryDate"
class="form-control" data-field="datetime"
data-format="dd-MMM-yyyy hh:mm:ss AA" readonly="true" />
<form:errors path="delivery_time" cssClass="error" />
</div>
<div id="dtBox"></div>
<div class="form-group">
<form:button type="submit" class="btn btn-success" role="button">Proceed to Order </form:button>
</div>
</form:form>
//<!-- Date and time picker -->
<script type="text/javascript">
$(document).ready(function() {
$("#dtBox").DateTimePicker({
dateFormat : "MM-dd-yyyy",
timeFormat : "HH:mm",
dateTimeFormat : "MM-dd-yyyy HH:mm:ss AA"
});
});
</script>
我无法复制DateTImePicker,因为代码超过30000行。