Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%@page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="UTF-8" %>
- <%@page import="java.sql.*"%>
- <%
- String driverName = "com.mysql.jdbc.Driver";
- String URL = "jdbc:mysql://localhost:3306/Poczta";
- String USERNAME = "root";
- String PASSWORD = "password";
- try{
- Class.forName(driverName);
- }catch(ClassNotFoundException e){
- e.printStackTrace();
- }
- Connection connection = null;
- Statement statement = null;
- ResultSet resultSet = null;
- %>
- <html>
- <head>
- <title>POCZTA</title>
- <style>
- .container0{
- width:1920px;
- height:400px;
- }
- .container1{
- float:left;
- width:950px;
- height:300px;
- }
- .container2{
- float:right;
- width:950px;
- height:300px;
- }
- .container3{
- float:left;
- width:100px;
- height:300px;
- }
- .container4{
- float:right;
- width:850px;
- height:300px;
- }
- .button0{
- width:80px;
- height:30px;
- border-radius:10px;
- color:black;
- }
- </style>
- </head>
- <body>
- <div class="contanair0">
- <div class="container1">
- <h2 align="center"><font><strong>Adresat</strong></font></h2>
- <table align="center" border="1">
- <tr bgcolor="#0066FF">
- <td><b>ID</b></td>
- <td><b>Imie</b></td>
- <td><b>Nazwisko</b></td>
- <td><b>Ulica</b></td>
- <td><b>Miasto</b></td>
- </tr>
- <%
- try{
- connection = DriverManager.getConnection(URL, USERNAME, PASSWORD);
- statement = connection.createStatement();
- String sql = "Select * FROM adresat";
- resultSet = statement.executeQuery(sql);
- while(resultSet.next()){
- %>
- <tr bgcolor="#3399FF">
- <td><%=resultSet.getInt("Id") %></td>
- <td><%=resultSet.getString("Imię") %></td>
- <td><%=resultSet.getString("Nazwisko") %></td>
- <td><%=resultSet.getInt("Ulica") %></td>
- <td><%=resultSet.getInt("Miasto") %></td>
- </tr>
- <%
- }
- connection.close();
- }catch(Exception e){
- e.printStackTrace();
- }
- %>
- </table>
- </div>
- <div class="container2">
- <h2 align="left" style="margin-left:55px"><font><strong>Menu</strong></font></h2>
- <div class="container3">
- <form action="index1.jsp">
- <button class="button0"><strong>Adresat</strong></button>
- </form>
- <form action="index2.jsp">
- <button class="button0"><strong>Nadawca</strong></button>
- </form>
- <form action="index3.jsp">
- <button class="button0"><strong>Paczka</strong></button>
- </form>
- <form action="index4.jsp">
- <button class="button0"><strong>Pracownik</strong></button>
- </form>
- <form action="index5.jsp">
- <button class="button0"><strong>Kurier</strong></button>
- </form>
- </div>
- <div class="container4">
- <form action="insert.jsp">
- <button class="button0"><strong>Add</strong></button>
- </form>
- <form action="delete.jsp">
- <button class="button0"><strong>Delete</strong></button>
- </form>
- <form action="update.jsp">
- <button class="button0"><strong>Update</strong></button>
- </form>
- <form>
- <button class="button0" onclick="location.reload()"><strong>Refresh</strong></button>
- </form>
- </div>
- </div>
- </div>
- </body>
- </html>
Add Comment
Please, Sign In to add comment