private Element updateProduct(HttpServletRequest request, Element elResult) {
		
		HttpSession session = request.getSession(true);
		Element elResponse = new Element ("response");
		
		if (!verifySession(request)) {
			elResponse.setAttribute("success", "-1");
			elResult.addContent(elResponse);
			return elResult;
		}
		
		
		String name = request.getParameter("name");
		String desc = request.getParameter("desc");
		String id = request.getParameter("id");
		String vendor_id = (String) session.getAttribute("user_id");
		
		SqlConn con = null;
		ResultSet rs = null;
		String sql = "";
		try {
			con = ConnFactory.getConnection("license");

			sql = "select count(*) as count from product where name = '" + name + "'";
			rs = con.query(sql);
			if (rs != null && rs.next()) {
				if (rs.getInt("count") > 0) {
					elResponse.setAttribute("success", "0");
					elResponse.setAttribute("errmsg", "The product exists.");
					elResult.addContent(elResponse);
					return elResult;
				}
			}
			if (!"".equals(id))
				sql = "update product set " +
						" name = '" + name + "', " +
						" description = '" + desc + "' " +
						" where id = '" + id + "'";
			else {
				sql = "insert into product values ('', " +
						"'" + name + "', " +
						"'" + desc + "', " +
						"'" + vendor_id + "')";
			}
			logger.info("sql is " + sql);
			con.update(sql);
			rs = null;
			sql = "select * from product where name = '" + name + "'";
			rs = con.query(sql);
			if(rs != null && rs.next()) {
				elResponse.setAttribute("prod_id", rs.getString("id"));
				elResponse.setAttribute("prod_name", name);
				elResponse.setAttribute("prod_desc", desc);
			}
			elResponse.setAttribute("success", "1");
		} catch (Exception e) {
			elResponse.setAttribute("errmsg", e.getMessage());
			elResponse.setAttribute("success", "0");
			logger.error(e.getMessage());
		} finally {
			con.close();
		}
		elResult.addContent(elResponse);
		return elResult;
	}