-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconsultarLibro.jsp
86 lines (77 loc) · 2.34 KB
/
consultarLibro.jsp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<%@ page import ="operacions.*" %>
<%@ page import="java.sql.*" %>
<%@ page import ="java.util.*" %>
<!--Cargo operacions, y un entero que me dice si el libro está prestado o no -->
<%
String statCon="nada";
OperacionsBiblioLibro operacions=new OperacionsBiblioLibro();
statCon = operacions.abrirConexion();
String id=request.getParameter("id");
try{
int ide = Integer.parseInt(id);
Libro libroConsultado = operacions.consultarLibro(ide);
int prestado = operacions.contarPrestamo(ide);
%>
<html>
<head>
<link rel="stylesheet" type="text/css" href="estilos.css" media="screen" />
<title><%=libroConsultado.getTitulo()%></title>
</head>
<body>
<!--Barra de titulo-->
<div class="bar_titulo">
<table class="tabla_titulo">
<tr>
<td width="10%">
<a class="boton" href="index.jsp">Volver</a>
</td>
<td width="90%">
<h3><%=libroConsultado.getTitulo()%></h3>
</td>
</tr>
</table>
</div>
<section><!--tabla -->
<div id="tabla">
<table border="1" class="tabla_seleccion">
<tr><th scope="col">ID</th><th scope="col">ISBN</th><th scope="col">Título</th><th scope="col">Autores</th><th scope="col">Ano</th><th scope="col">Prestado</th><th scope="col">Accións</th><th scope="col">Eliminar</th></tr>
<tr>
<td><%=libroConsultado.getIdLibro() %></td>
<td><%=libroConsultado.getISBN()%></td>
<td><%=libroConsultado.getTitulo()%></td>
<td><%=libroConsultado.getAutores()%></td>
<td><%=libroConsultado.getAno()%></td>
<td>
<!--Si el libro está prestado, prestamo tiene valor 1 -->
<%
if (prestado == 1) {
%>
<span style="background:#FF0000"> Prestado </span>
<%
} else {
%>
<span style="background:#00FF00"> Disponible </span>
<%
}
%>
</td>
<td>
<a class="boton" href="modificarLibro.jsp?id=<%=libroConsultado.getIdLibro()%>">Modificar</a></td>
<td><a class="boton boton_rojo" href="index.jsp?borrar=<%=libroConsultado.getIdLibro()%>">Borrar</a>
</tr>
<%
operacions.cerrarConexion();
}catch(Exception e){
out.println("Error"+e.getMessage());
}
%>
</table>
</div>
</body>
<!--Muestro los errores con getErro en el pie de la pagina-->
<footer class="pie"><!--Pie-->
<div >
<span>JDBC version:<%=statCon%> ||</span><span style="color:#FF0000">Consola: <%=operacions.getErro()%></span>
</div>
</footer>
</html>