Access a javascript variable inside a JSP block?

Im creating a cms page, and what i want to do is to delete from my database(on button click) all userid that are checked in the list of userid

<%

//registering the driver

Class.forName("org.gjt.mm.mysql.Driver").newInstance();

//defining URL of database server

String url ="jdbc:mysql://localhost:3306/database";

String uname ="jayson";

String pswd ="jayson";

//getting the connection

Connection connect = DriverManager.getConnection(url, uname, pswd);

%>

<script type="text/JavaScript">

function jsDELETE(){

for (var i=0; i < document.form1.checkpending.length; i++)

{

if (document.form1.checkpending[i].checked)

{

<%

Statement stmnt;

stmnt = connect.createStatement();

//i am getting the error here

String sq ="DELETE FROM credentials where UserId = " + document.form1.checkpending[i].value;

stmnt.executeUpdate(sq);

%>

}

}

}

//-->

</script>

i am trying to append checked values(document.form1.checkpending.value ) to my sql statement but i am getting an error.

Is there a better way to do these?

thanks in advance. =)

[1771 byte] By [jayson17a] at [2007-11-27 11:24:22]
# 1

Doublepost: http://forum.java.sun.com/thread.jspa?threadID=5197585

If you don't understand the answers provided in your former topic, please ask specific questions.

The cause is that you're mixing two completely different languages and expecting that they can interact with each other. Don't do that.

BalusCa at 2007-7-29 15:57:53 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...