Guest User

Untitled

a guest
Jun 2nd, 2018
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.94 KB | None | 0 0
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd">
  3. <sqlMap namespace="Cliente">
  4. <procedure id="listarcliente" resultClass="controller.Cliente">
  5. { call ListarClientes() }
  6. </procedure>
  7. </sqlMap>
  8.  
  9. <?xml version="1.0" encoding="UTF-8"?>
  10. <!DOCTYPE sqlMapConfig PUBLIC "-//ibatis.apache.org//DTD SQL Map Config 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-config-2.dtd">
  11.  
  12. <sqlMapConfig>
  13. <settings useStatementNamespaces="true"/>
  14.  
  15. <transactionManager type="JDBC">
  16. <dataSource type="SIMPLE">
  17.  
  18. <property name="JDBC.Driver" value="com.mysql.jdbc.Driver"/>
  19. <property name="JDBC.ConnectionURL" value="jdbc:mysql://localhost:3306/cibertec2018"/>
  20. <property name="JDBC.Username" value="root"/>
  21. <property name="JDBC.Password" value="mysql"/>
  22.  
  23. </dataSource>
  24. </transactionManager>
  25.  
  26. <sqlMap resource="Cliente.xml"/>
  27. </sqlMapConfig>
  28.  
  29. public class Cliente {
  30. private int idcliente;
  31. private String nombres;
  32. private String ciudad;
  33. private String sexo;
  34. private String telefono;
  35. private String fecha_nacimiento;
  36.  
  37. public Cliente() {
  38. }
  39.  
  40. public Cliente(int idcliente, String nombres, String ciudad, String sexo, String telefono, String fecha_nacimiento) {
  41. this.idcliente = idcliente;
  42. this.nombres = nombres;
  43. this.ciudad = ciudad;
  44. this.sexo = sexo;
  45. this.telefono = telefono;
  46. this.fecha_nacimiento = fecha_nacimiento;
  47. }
  48.  
  49. public int getIdcliente() {
  50. return idcliente;
  51. }
  52.  
  53. public void setIdcliente(int idcliente) {
  54. this.idcliente = idcliente;
  55. }
  56.  
  57. public String getNombres() {
  58. return nombres;
  59. }
  60.  
  61. public void setNombres(String nombres) {
  62. this.nombres = nombres;
  63. }
  64.  
  65. public String getCiudad() {
  66. return ciudad;
  67. }
  68.  
  69. public void setCiudad(String ciudad) {
  70. this.ciudad = ciudad;
  71. }
  72.  
  73. public String getSexo() {
  74. return sexo;
  75. }
  76.  
  77. public void setSexo(String sexo) {
  78. this.sexo = sexo;
  79. }
  80.  
  81. public String getTelefono() {
  82. return telefono;
  83. }
  84.  
  85. public void setTelefono(String telefono) {
  86. this.telefono = telefono;
  87. }
  88.  
  89. public String getFecha_nacimiento() {
  90. return fecha_nacimiento;
  91. }
  92.  
  93. public void setFecha_nacimient(String fecha_nacimiento) {
  94. this.fecha_nacimiento = fecha_nacimiento;
  95. }
  96.  
  97.  
  98.  
  99. }
  100.  
  101. <%@page import="controller.IbatisrRead"%>
  102. <%@page import="java.util.ArrayList" %>
  103. <%@page import="controller.Cliente" %>
  104.  
  105. <%@page contentType="text/html" pageEncoding="UTF-8"%>
  106. <!DOCTYPE html>
  107. <html>
  108. <head>
  109. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  110. <title>Listado de productos</title>
  111. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" />
  112.  
  113. <%
  114. IbatisrRead objRead = new IbatisrRead();
  115. ArrayList<Cliente> obj = new ArrayList<Cliente>();
  116. obj = objRead.Listado();
  117. %>
  118. </head>
  119. <body>
  120. <div class="container">
  121. <h1>Listado de clientes</h1>
  122. <table class="table table-bordered">
  123. <thead>
  124. <th>IdCliente</th>
  125. <th>Nombres</th>
  126. <th>Ciudad</th>
  127. <th>Sexo</th>
  128. <th>Telefono</th>
  129. <th>Fecha Nacimiento</th>
  130. <th></th>
  131. </thead>
  132. <tbody>
  133. <!-- iniciar recorrido-->
  134.  
  135. <% for(Cliente c: obj){ %>
  136. <tr>
  137. <td>
  138. <%=c.getIdcliente() %>
  139. </td>
  140. <td>
  141. <%=c.getNombres() %>
  142. </td>
  143. <td>
  144. <%=c.getCiudad() %>
  145. </td>
  146. <td>
  147. <%=c.getSexo() %>
  148. </td>
  149. <td>
  150. <%=c.getTelefono()%>
  151. </td>
  152. <td>
  153. <%=c.getFecha_nacimiento()%>
  154. </td>
  155. <td>
  156. <a href="#">Editar</a> |
  157. <a href="#" onclick="Confirmar(<%= c.getIdcliente()%>)">Eliminar</a>
  158. </td>
  159. </tr>
  160. <%}%>
  161.  
  162. </tbody>
  163. </table>
  164. <a href="NuevoRegistro.jsp" class="btn btn-primary">Registrar clientes</a>
  165. <a href="BuscarProducto.jsp" class="btn btn-primary">Buscar clientes</a>
  166. </div>
  167. </body>
  168. </html>
  169.  
  170. <script>
  171. function Confirmar(id){
  172.  
  173. if (confirm("¿Desea eliminar el registro " + id + "?")) {
  174. location.href = "/ExamenEL3/Delete.jsp?id=" + id;
  175. }
  176.  
  177. }
  178.  
  179. </script>
Add Comment
Please, Sign In to add comment