老师,如何往MySQL中插入text和longtext类型的内容??
request.setCharacterEncoding("utf-8"); String title = request.getParameter("title"); String container = request.getParameter("area2"); Connection conn = null; Statement stmt = null; String sql = "insert news1(title,container) values" + "(" + title + "," + container + ")"; try { conn = DBhelper.getConnection(); stmt = conn.createStatement(); stmt.executeUpdate(sql); response.sendRedirect(request.getContextPath() + "/success.jsp"); } catch (Exception ex) { ex.printStackTrace(); }
这是我用Servlet处理的,可是并没有写到MySQL中呀