Advertisement
Guest User

Untitled

a guest
Jul 19th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. <%@page import = "javax.servlet.*"%>
  2. <%@page import="java.sql.*"%>
  3.  
  4. <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
  5. pageEncoding="ISO-8859-1"%>
  6.  
  7.  
  8. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  9. <html>
  10. <head>
  11. <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  12. <title>Insert title here</title>
  13. </head>
  14. <body>
  15. <%
  16.  
  17. try{
  18. Class.forName("com.mysql.jdbc.Driver");
  19. }catch(Exception e){}
  20.  
  21. try{
  22.  
  23. Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/jeet","root","jeet");
  24.  
  25. Statement stmt = con.createStatement();
  26.  
  27. ResultSet rs = stmt.executeQuery("select * from jeet");
  28.  
  29. while(rs.next()){%>
  30.  
  31. <table>
  32.  
  33. <tr>
  34. <td>
  35. <%
  36. rs.getInt("id");
  37. %>
  38. </td>
  39. <td>
  40. <%
  41. rs.getString("bname");
  42. %>
  43. </td>
  44.  
  45. <td>
  46. <%
  47. rs.getString("author");
  48. %>
  49. </td>
  50.  
  51. <td>
  52. <%
  53. rs.getInt("price");
  54. %>
  55. </td>
  56. </tr>
  57.  
  58. </table>
  59.  
  60. <%}
  61.  
  62.  
  63. }catch(Exception e){
  64.  
  65. }
  66.  
  67. %>
  68.  
  69. </body>
  70. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement