Java Web desde cero en Netbeans ☁️[12.- JSP y MySQL borrar registros]
En este tutorial vamos borrar nuestros empleados atrevas de nuestro formulario de html.
Codigo: https://github.com/programadornovato/javaWeb/commit/37ba24447504afb1bb19e7d0f76b678582e59788
<%@page import="java.sql.*"%>
<%@page import="com.mysql.jdbc.Driver"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<%
Connection con = null;
Statement st = null;
try {
Class.forName("com.mysql.jdbc.Driver");
con = DriverManager.getConnection("jdbc:mysql://localhost/jsp?user=eugenio&password=123456");
st = con.createStatement();
st.executeUpdate("delete FROM empledos where id='"+request.getParameter("id") +"';");
request.getRequestDispatcher("index.jsp").forward(request, response);
} catch (Exception e) {
out.print(e);
}
%>
</body>
</html>
Curso de Java de 0 a 100: https://www.youtube.com/playlist?list=PLCTD_CpMeEKTT-qEHGqZH3fkBgXH4GOTF
? Esta lista de reproducción: https://www.youtube.com/playlist?list=PLCTD_CpMeEKRAgcBmPee0Wjx5HsJ0nb0L
Codigos en gdrive: https://drive.google.com/file/d/10uLG9o2oDV-qB32G4kMIpzXgLCiUYaYz/view?usp=sharing
Gracias por apoyar este canal: https://www.patreon.com/programadornovato?fan_landing=true
? Facebook: https://facebook.com/ProgramadorNovatoOficial
? Twitter: https://twitter.com/programadornova
? Linkedin: https://www.linkedin.com/in/programadornovato/
? Instagram: https://www.instagram.com/programadornovato/