Guest User

Untitled

a guest
Jun 11th, 2016
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.46 KB | None | 0 0
  1. <%@page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="UTF-8" %>
  2. <%@page import="java.sql.*"%>
  3.  
  4. <%
  5. String driverName = "com.mysql.jdbc.Driver";
  6. String URL = "jdbc:mysql://localhost:3306/Poczta";
  7. String USERNAME = "root";
  8. String PASSWORD = "password";
  9.  
  10. try{
  11. Class.forName(driverName);
  12. }catch(ClassNotFoundException e){
  13. e.printStackTrace();
  14. }
  15.  
  16. Connection connection = null;
  17. Statement statement = null;
  18. ResultSet resultSet = null;
  19. %>
  20. <html>
  21. <head>
  22.  
  23. <title>POCZTA</title>
  24.  
  25. <style>
  26.  
  27. .container0{
  28. width:1920px;
  29. height:400px;
  30. }
  31.  
  32. .container1{
  33. float:left;
  34. width:950px;
  35. height:300px;
  36. }
  37.  
  38. .container2{
  39. float:right;
  40. width:950px;
  41. height:300px;
  42. }
  43.  
  44. .container3{
  45. float:left;
  46. width:100px;
  47. height:300px;
  48. }
  49.  
  50. .container4{
  51. float:right;
  52. width:850px;
  53. height:300px;
  54. }
  55.  
  56. .button0{
  57. width:80px;
  58. height:30px;
  59. border-radius:10px;
  60. color:black;
  61. }
  62.  
  63. </style>
  64.  
  65. </head>
  66. <body>
  67.  
  68. <div class="contanair0">
  69.  
  70. <div class="container1">
  71.  
  72. <h2 align="center"><font><strong>Adresat</strong></font></h2>
  73.  
  74. <table align="center" border="1">
  75. <tr bgcolor="#0066FF">
  76. <td><b>ID</b></td>
  77. <td><b>Imie</b></td>
  78. <td><b>Nazwisko</b></td>
  79. <td><b>Ulica</b></td>
  80. <td><b>Miasto</b></td>
  81. </tr>
  82.  
  83. <%
  84. try{
  85. connection = DriverManager.getConnection(URL, USERNAME, PASSWORD);
  86. statement = connection.createStatement();
  87. String sql = "Select * FROM adresat";
  88.  
  89. resultSet = statement.executeQuery(sql);
  90. while(resultSet.next()){
  91. %>
  92.  
  93. <tr bgcolor="#3399FF">
  94. <td><%=resultSet.getInt("Id") %></td>
  95. <td><%=resultSet.getString("Imię") %></td>
  96. <td><%=resultSet.getString("Nazwisko") %></td>
  97. <td><%=resultSet.getInt("Ulica") %></td>
  98. <td><%=resultSet.getInt("Miasto") %></td>
  99. </tr>
  100.  
  101. <%
  102. }
  103. connection.close();
  104. }catch(Exception e){
  105. e.printStackTrace();
  106. }
  107. %>
  108. </table>
  109.  
  110. </div>
  111.  
  112. <div class="container2">
  113.  
  114. <h2 align="left" style="margin-left:55px"><font><strong>Menu</strong></font></h2>
  115.  
  116. <div class="container3">
  117.  
  118. <form action="index1.jsp">
  119. <button class="button0"><strong>Adresat</strong></button>
  120. </form>
  121.  
  122. <form action="index2.jsp">
  123. <button class="button0"><strong>Nadawca</strong></button>
  124. </form>
  125.  
  126. <form action="index3.jsp">
  127. <button class="button0"><strong>Paczka</strong></button>
  128. </form>
  129.  
  130. <form action="index4.jsp">
  131. <button class="button0"><strong>Pracownik</strong></button>
  132. </form>
  133.  
  134. <form action="index5.jsp">
  135. <button class="button0"><strong>Kurier</strong></button>
  136. </form>
  137.  
  138. </div>
  139.  
  140. <div class="container4">
  141.  
  142. <form action="insert.jsp">
  143. <button class="button0"><strong>Add</strong></button>
  144. </form>
  145.  
  146. <form action="delete.jsp">
  147. <button class="button0"><strong>Delete</strong></button>
  148. </form>
  149.  
  150. <form action="update.jsp">
  151. <button class="button0"><strong>Update</strong></button>
  152. </form>
  153.  
  154. <form>
  155. <button class="button0" onclick="location.reload()"><strong>Refresh</strong></button>
  156. </form>
  157.  
  158. </div>
  159.  
  160. </div>
  161.  
  162. </div>
  163.  
  164. </body>
  165. </html>
Add Comment
Please, Sign In to add comment