com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException: Column 'goodsName' cannot be null
出現這錯誤,是我封裝頁面的時候出現的錯誤。
private void addGoods(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
// 1.封裝頁面的數據
FromGoods bean = WebUtils.fillFormBean(request, FromGoods.class);
// 3.創建Goods對象,並拷貝formbean的數據
Goods u = new Goods();
try {
BeanUtils.copyProperties(u, bean);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// 4.調用service層完成添加的操作
gs.add(u);
// 5.重新計算總頁面等等
getAllGoods(request, response);
}
