//修改的方法
function editProduct() {
var selectedRows = $("#dg").datagrid('getSelections');
if (selectedRows.length != 1) {
$.messager.alert("系統(tǒng)提示", "請(qǐng)選擇一條要編輯的數(shù)據(jù)!");
return;
}
var row = selectedRows[0];
$("#w").dialog("open").dialog("setTitle", "編輯商品信息");
$("#ff").form("load", row);
url = "${pageContext.request.contextPath}/ProductServlet?method=Edit_P&pid=" + row.pid;
}
//保存
function save() {
$("#ff").form("submit", {
url : url,
success : function(result) {
if (result.errorMsg) {
$.messager.alert("系統(tǒng)提示", result.errorMsg);
return;
} else {
$.messager.alert("系統(tǒng)提示", "保存成功");
$("#w").dialog("close");
$("#dg").datagrid("reload");
}
}
});
}
//update
public String Edit_P(HttpServletRequest req, HttpServletResponse resp) throws SQLException, IOException {
Product p = MyBeanUtils.populate(Product.class, req.getParameterMap());
ProductService productService = new ProductServiceImpl();
productService.edit(p);
return "/admin/product/list.jsp";
}
java 空指針問(wèn)題Caused by: java.lang.NullPointer
陪伴而非守候
2019-04-18 17:15:35