我的jsp页面:while(rs.next()){%>
"target="_blank">我的jsp页面:
while (rs.next()) {
%>
在jsp中以一个表格的形式输出,在每一行后面都有一个删除链接,如何一点连接就删除一行。
delete.java代码
public class updata {
public String execute()throws Exception{
String driverName = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
String url = "jdbc:sqlserver://127.0.0.1:1433;DatabaseName=zap";
String userName = "sa";
String password = "123";
Connection con=null;
Statement stmt=null;
try{
Class.forName(driverName).newInstance();
con=DriverManager.getConnection(url , userName,
password);
stmt=con.createStatement();
}
catch(Exception e){
System.out.println(e.getMessage());
}
?????(如何获得id的值)
int sql = stmt.executeUpdate("delete from note where ID=?");
con.commit();
if(sql != 0)
{ return "deletesuccess";
}
else{
return "deletefail"; }
}
}
展开