Advertisement
Guest User

Untitled

a guest
Jul 30th, 2014
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.18 KB | None | 0 0
  1. <%
  2. if ((session.getAttribute("user") == null) || (session.getAttribute("user") == "")) {
  3. response.sendRedirect("login.jsp");
  4. }
  5. %>
  6. <%@ include file="conexion.jsp" %>
  7. <%--
  8. Document : implstprov
  9. Created on : Jul 30, 2014, 2:45:04 AM
  10. Author : Luser
  11. --%>
  12.  
  13. <%@page contentType="text/html" pageEncoding="UTF-8"%>
  14. <!DOCTYPE html>
  15. <html>
  16. <head>
  17. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  18. <title>Impresion de Catalogo de Proveedores...</title>
  19. </head>
  20. <body>
  21. <%
  22. conexion con = new conexion();
  23. String qry = "select * from tcatprov order by ccatprovcodigo";
  24. // out.println(qry);
  25. ResultSet rs = con.consulta(qry);
  26. if (rs.next()) {
  27. out.println(" <form method=\"get\" action=\"catprov.jsp\">");
  28. out.println("<table border=1 cellpadding=5>");
  29. out.println("<tr>");
  30. out.println("<th>Codigo</th>");
  31. out.println("<th>Nombre Proveedor</th>");
  32. out.println("</tr>");
  33. while(rs.next()){
  34. out.println("<tr><td>" + rs.getString(1) + "</td><td>" + rs.getString(2) + "</td></tr>");
  35. }
  36. out.println("</table><br><br>");
  37. out.println("<input type=\"submit\" value=\"Grabar\" />");
  38. out.println("</form>");
  39. }
  40. else {
  41. String wmess = "No hay registros de Proveedores..." ;
  42. out.println("<script type=\"text/JavaScript\">");
  43. out.println("alert(\""+wmess+"\")");
  44. out.println("window.location = \"catprov.jsp\"");
  45. out.println("</script>");
  46. }
  47. %>
  48. </body>
  49. </html>
  50.  
  51.  
  52. mysql> select * from tcatprov order by ccatprovcodigo;
  53. +------------+----------------+-----------------+
  54. | icatprovid | ccatprovcodigo | ccatprovnombre |
  55. +------------+----------------+-----------------+
  56. | 2 | 111 | MANUEL LOPEZ |
  57. | 1 | 123 | MIGUEL ENRIQUEZ |
  58. +------------+----------------+-----------------+
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement