Guest User

Untitled

a guest
Oct 18th, 2017
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.08 KB | None | 0 0
  1. <%--
  2. Document : listadoProfesores
  3. Created on : 16-oct-2017, 21:59:45
  4. Author : Zirok9511
  5. --%>
  6.  
  7. <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
  8. <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
  9.  
  10. <%@page contentType="text/html" pageEncoding="UTF-8"%>
  11. <!DOCTYPE html>
  12. <html>
  13. <head>
  14. <meta charset="UTF-8">
  15. <title>Sistema Universitario</title>
  16. <link rel="stylesheet" href="style.css">
  17. </head>
  18. <body>
  19. <center>
  20. <sql:setDataSource var="ds" driver="com.microsoft.sqlserver.jdbc.SQLServerDriver" url="jdbc:sqlserver://LOCALHOST\SQLEXPRESS:1433;DatabaseName=Compras" user="sa" password="9511" ></sql:setDataSource>
  21. <sql:query var="profesores" dataSource="${ds}">
  22. select * from profesores
  23. </sql:query>
  24. <h2>Listado de profesores</h2>
  25. <table>
  26. <thead>
  27. <tr>
  28. <th>Dui</th><th>Nombre</th><th>Titulo</th><th>Acciones</th>
  29. </tr>
  30. </thead>
  31. <tbody>
  32. <c:forEach var="profesor" begin="0" items="${profesores.rows}">
  33. <tr>
  34. <td>${profesor.dui}</td>
  35. <td>${profesor.nombre}</td>
  36. <td>${profesor.titulo}</td>
  37. <td>
  38. <a href='detalleProfesor.jsp?id=${profesor.id}'>
  39. <input type="submit" value="Detalle"/>
  40. </a>
  41. <a href='eliminarProfesor.jsp?id=${profesor.id}'>
  42. <input type="submit" value="Eliminar"/>
  43. </a>
  44. </td>
  45. </tr>
  46. </c:forEach>
  47. </tbody>
  48. <tfoot>
  49. <tr>
  50. <td>
  51. <a href='agregarProfesor.jsp'>
  52. <input type="submit" name="action" value="Agregar"/>
  53. </a>
  54. </td><td></td><td></td><td></td>
  55. </tr>
  56. </tfoot>
  57. </table>
  58. </center>
  59. </body>
  60. </html>
  61.  
  62.  
  63.  
  64. **Al darle detalle obtengo los datos de este. solo me falta las 3 sentencias mencionadas anteriormente.**
  65.  
  66. <%--
  67. Document : detalleProfesor
  68. Created on : 16-oct-2017, 21:47:15
  69. Author : Zirok9511
  70. --%>
  71.  
  72. <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
  73. <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
  74.  
  75. <%@page contentType="text/html" pageEncoding="UTF-8"%>
  76. <!DOCTYPE html>
  77. <html>
  78. <head>
  79. <meta charset="UTF-8">
  80. <title>Detalle de Profesor</title>
  81. <link rel="stylesheet" href="style.css">
  82. </head>
  83. <body>
  84. <center>
  85. <sql:setDataSource var="ds" driver="com.microsoft.sqlserver.jdbc.SQLServerDriver"
  86. url="jdbc:sqlserver://LOCALHOST\SQLEXPRESS:1433;DatabaseName=Compras" user="sa" password="9511" ></sql:setDataSource>
  87. <sql:query var="profesores" dataSource="${ds}">
  88. select * from profesores where id = ?
  89. <sql:param value="${param.id}" />
  90. </sql:query>
  91. <h1>Sistema Universitario</h1>
  92. <h2>Detalle de Profesor</h2>
  93. <input type="hidden" name="id" value="${profesor.id}"/>
  94. <table style="width:400px;">
  95. <thead>
  96. <tr><th></th><th></th></tr>
  97. </thead>
  98. <tbody>
  99. <c:forEach var="profesor" begin="0" items="${profesores.rows}">
  100. <tr><td>Nombre:</td><td>
  101. <input type="text" name="nombre" value="${profesor.nombre}"/></td>
  102. </tr>
  103. <tr><td>Dui</td>
  104. <td><input type="text" name="cedula" value="${profesor.dui}"/></td>
  105. </tr>
  106. <tr><td>Titulo:</td>
  107. <td><input type="text" name="titulo" value="${profesor.titulo}"/></td>
  108. </tr>
  109. <tr><td>Area:</td>
  110. <td><input type="text" name="area" value="${profesor.area}"/></td>
  111. </tr>
  112. <tr><td>Telefono:</td>
  113. <td><input type="text" name="telefono" value="${profesor.telefono}"/></td>
  114. </tr>
  115. </c:forEach>
  116. </tbody>
  117. <tfoot>
  118. <tr>
  119. <td><input type="submit" value="Actualizar" />
  120. </td>
  121. <td><a href='listadoProfesores.jsp'>
  122. <input type="submit" name="action" value="Listado Profesores"/>
  123. </a>
  124. </td>
  125. </tr>
  126. </tfoot>
  127. </table>
  128. </center>
  129. </body>
  130. </html>
Add Comment
Please, Sign In to add comment