com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException: Column 'goodsName' cannot be null

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);
	}
原文地址:https://www.cnblogs.com/ouysq/p/4536881.html