Index Libros
Index Libros
Index Libros
DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="Description" content="Enter your description here"/>
<link rel="icon" type="image/ico" href="libro.ico">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-
bootstrap/4.5.3/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-
awesome/5.15.1/css/all.min.css">
<link rel="stylesheet" href="assets/css/style.css">
<title>Insertar</title>
</head>
<header>
<nav class="navbar navbar-expand-sm bg-dark navbar-dark">
<!-- Brand/logo -->
<table id="tabl">
<tr>
<td id="image">
<div class="img-header" display="flex">
<a class="navbar-brand" href="#">
<img id="libr" src="librox112.png" alt="logo">
</a>
</div>
</td>
<td id="tittle">
<table>
<tr><a href="http://">Mostrar</a></tr>
<tr><a href="http://">Eliminar</a></tr>
</table>
</td>
<td id="sesion" class="bot1">
</td>
<td id="sesion">
<div class="btn-group" role="group" aria-label="Button group with nested
dropdown">
<div class="btn-group" role="group">
<div id="sing " class=" boton ">
<button id="boton-ini" onclick="go()" class=" dropdown-toggle bot2"
value="Sign In" type="button"
data-bs-toggle="dropdown" aria-expanded="false">
Logout</button>
<ul class="dropdown-menu" aria-labelledby="btnGroupDrop1">
<li><a class="dropdown-item" href="#">login</a></li>
<li><a class="dropdown-item" href="#">Forgot Password</a></li>
</ul>
</div>
</div>
</div>
</td>
</tr>
</table>
</nav>
</header>
<body>
conexion = DriverManager.getConnection(
"jdbc:postgresql://localhost:5432/data9", "postgres",
"123");
sentencia = conexion.createStatement();
//3
String consultaSQL = "insert into Libros (isbn,titulo) values ";
consultaSQL += "('" + isbn + "','" + titulo + "')";
//4
filas = sentencia.executeUpdate(consultaSQL);
response.sendRedirect("mostrar.jsp");
} catch (ClassNotFoundException e) {
System.out.println("Error en la carga del driver"
+ e.getMessage());
} catch (SQLException e) {
System.out.println("Error accediendo a la base de datos"
+ e.getMessage());
} finally {
//5
if (sentencia != null) {
try {sentencia.close();}
catch (SQLException e)
{System.out.println("Error cerrando la sentencia" +
e.getMessage());}
}
if (conexion != null) {
try {conexion.close();}
catch (SQLException e)
{System.out.println("Error cerrando la conexion" +
e.getMessage());}
}
}%>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.slim.min.js"></scri
pt>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.1/umd/popper.min.js"></s
cript>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-
bootstrap/4.5.3/js/bootstrap.min.js"></script>
</body>
<footer>
<nav class="navbar navbar-expand-sm bg-dark navbar-dark">
<h1 id="footer">despedida</h1>
</nav>
</footer>
</html>
insertar de luis
<body>
<div class="container">
<form action="insertar.jsp" method="post">
<div class="from-group">
<label for="ISBN">ISBM</label>
<input type="text" class="form-control" placeholder="Entre
el ISBN" id="isbn" name="isbn">
</div>
<div class="from-group">
<label for="Titulo">ISBM</label>
<input type="text" class="form-control" placeholder="Titulo del
Libro" id="titulo" name="titulo">
</div>
<button type="submit" class="btn btn-default">Insertar</button>
</form>
</div>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.slim.min.js"></scri
pt>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.1/umd/popper.min.js"></s
cript>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-
bootstrap/4.6.0/js/bootstrap.min.js"></script>
</body>
mostrar.jsp
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="Description" content="Enter your description here" />
<link rel="icon" type="image/ico" href="libro.ico">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-
bootstrap/4.5.3/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-
awesome/5.15.1/css/all.min.css">
<link rel="stylesheet" href="assets/css/style.css">
<link rel="stylesheet" href="estilos.css">
<title>Inicio</title>
</head>
<header>
<nav class="navbar navbar-expand-sm bg-dark navbar-dark">
<!-- Brand/logo -->
<table id="tabl">
<tr>
<td id="image">
<div class="img-header" display="flex">
<a class="navbar-brand" href="#">
<img id="libr" src="librox112.png" alt="logo">
</a>
</div>
</td>
<td id="tittle">
<h2>Bibliotecas Digitales</h2>
</td>
<td id="sesion">
</nav>
</header>
<body id="bdin">
<!--<hr class="dropdown-divider" id="divider">-->
<div class="container">
<h2 id="titulo2">Registro de libros</h2>
<fieldset id="fiel">
<form action="insertar.jsp" method="post">
<div class="from-group">
<label for="ISBN"></label>
<input type="text" class="form-control" placeholder="Entre el
ISBN" id="isbn" name="isbn">
</div>
<div class="from-group">
<label for="Titulo"></label>
<input type="text" class="form-control" placeholder="Titulo del
Libro" id="titulo" name="titulo">
</div>
<button id="env" type="submit" class="btn btn-primary btn-
default">Insertar</button>
<a href="vista.jsp" class="btn btn-primary"><button id="env"
type="button" class="btn btn-primary btn-default">Mostrar</button></a>
</form>
</fieldset>
</div>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.slim.min.js"></scri
pt>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.1/umd/popper.min.js"></s
cript>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-
bootstrap/4.5.3/js/bootstrap.min.js"></script>
</body>
<footer>
<nav class="navbar navbar-expand-sm bg-dark navbar-dark">
<h1 id="footer"></h1>
</nav>
</footer>
</html>