嗨,有人可以帮我弄清楚我的愚蠢错误在哪里。我正在尝试在互联网上查找,但找不到最佳解决方案。我有一个 jsp 和 java 控制器,我应该能够从数据库中删除一条记录,以下是我的代码。任何帮助都会得到承认
public void doDel(HttpServletRequest request, HttpServletResponse response) throws ClassNotFoundException, InstantiationException, IllegalAccessException{
try {
HttpSession session = request.getSession(true);
messageBean mbean = new messageBean();
int id = mbean.getMesId();
String sql;
sql = "DELETE * from message where id =?";
Class.forName(driver).newInstance();
conn = DriverManager.getConnection(url);
st = conn.createStatement();
ps = conn.prepareStatement(sql);
ps.setInt(1, id);
ps.executeUpdate();
conn.commit();
conn.close();