Buona sera a tutti, forse la mia domanda sarà banale ma cercando su internet non ho trovato quello che volevo sapere quindi pongo a voi il mio problema:
vorrei sapere se è possibile inserire in una jsp più query ad esempio:
vi metto sia il codice html per avere un'idea di quello che vorrei fare e poi sotto quello in jsp. :
HTML
<html>
<head>
<title> Dati</title>
<link rel="stylesheet" type="text/css" href="stile.css">
</head>
<body>
<h1 class="formattazione">Cancella Utente</h1>
<table border="1" class="speciale8" >
<td colspan="2">
<h2 >Cancella Utente:</h2>
<form name= "mioForm" method="post" action="delete.jsp">
</p>
<label>Password:
<input name="pass" type="text" size="20">
</label></p>
<h2 >Cancella gruppo:</h2>
<label>id gruppo:
<input name="id" type="text" size="20">
</label></p>
<input type="submit" value="send data">
<input type="reset" value="reset data">
</form>
</td></table>
</body>
</html>
JSP.
<%@page import="java.sql.*,java.text.DecimalFormat"%>
<html>
<head>
<link rel="stylesheet" type="text/css" href="stile.css"></head>
<style></style>
<body>
<h1 class="formattazione"> cancellare Utente</h1>
<table border="1" class="speciale8" >
<td colspan="2">
<%
String nome = request.getParameter("nome");
String pass = request.getParameter("pass");
String query="DELETE FROM utente WHERE pass='"+pass+"'";
try{
Class.forName("com.mysql.jdbc.Driver").newInstance ();
Connection c=DriverManager.getConnection("jdbc:mysql://localhost:3306/mydb?user=root&password=password");
Statement s=c.createStatement();
int risultato =s.executeUpdate(query);
out.println ("Ho effettuato la cancellazione");
%>
// Qui diciamo che vorrei inserire questa seconda query
<h1 class="formattazione"> cancellare gruppo</h1>
<%
String id = request.getParameter("id");
String query="DELETE FROM gruppo WHERE pass='"+id+"'";
s.close();
c.close();
}
catch(SQLException e){
out.println(e.getErrorCode());
}
%>
</td>
</table>
</body>
</html>
E' possibile fare una cosa simile?
Vi ringrazio.