一,兩種跳轉方式:css
<button type="button" onclick="window.history.back();" class="btn btn-danger">取 消</button>java
這裏設置的按鈕是返回上一級jsp
<a href="editStock" class="btn btn-danger">取 消</a>ui
這裏設置的是使用鏈接按鈕返回到指定頁面spa
二,validation的複習(項目實現eidtStock.jsp頁面的信息驗證)code
1.StockForm.javaorm
@NotEmpty(field="庫存", message="{errors.required}") private String stock;
2.StockController.javaget
List<Item> commodityList = itemListComponent.getCommodityList(); model.addAttribute("commodityList", commodityList); if (results.hasErrors()) { log.info("內容驗證出錯"); return "manager/stock/editStock"; }
3.editStock.jsp
input
<div class="alert alert-info">${message}<form:errors path="*"></form:errors></div> <td style="background-color: #f9f9f9;">庫存</td> <td><form:input path="stock" cssClass="form-control" cssErrorClass="form-control error" value="${stockForm.stock}" /></td>