jsp页面根据ID传值修改是在后台调用update接口:
在jdbc操作接口中写入如下代码:
conn.setAutoCommit(false);//不用自己提交要执行完成后提交
String sql="insert into [article] values(?,?,?,?,getdate(),0)";
PreparedStatement pstm = conn.prepareStatement(sql);
pstm.setInt(1,id);
pstm.setInt(2,rootid);
pstm.setString(3,title);
pstm.setString(4,cont);
pstm.executeUpdate();
Statement st = conn.createStatement();
String sql1 = "update [article] set isleaf=1 where id="+id;//这里的id是jsp页面传过来的
st.executeUpdate(sql1);
执行完以上sql后,数据就根据id被更新了。