Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%--
- Document : DeliveryBoyInfo
- Created on : Apr 11, 2017, 1:20:12 AM
- Author : AlinIQin
- --%>
- <%@ page import="java.sql.*" %>
- <%@ page import="java.sql.Connection" %>
- <%@ page import="java.sql.DriverManager" %>
- <%@ page import="java.util.HashMap" %>
- <%@ page import="java.util.Map" %>
- <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
- <%@page contentType="text/html" pageEncoding="UTF-8" %>
- <!DOCTYPE html>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <title>Delivery Boy Information</title>
- <style type="text/css">
- * {
- font-family: cursive;
- }
- body {
- background: pink;
- color: black;
- font-family: cursive;
- }
- table, th, td {
- border: 1px solid black;
- text-align: center;
- }
- </style>
- </head>
- <body>
- <%
- Connection connection = null;
- boolean valid = false;
- ResultSet rs = null;
- String employee_id = null;
- // Map<String, String> list = new HashMap<String, String>();
- // ArrayList al = new ArrayList();
- try {
- Class.forName("com.mysql.jdbc.Driver").newInstance();
- String connectionURL = "jdbc:mysql://127.0.0.1/projek1?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC";
- connection = DriverManager.getConnection(connectionURL, "root", "");
- connection.createStatement();
- PreparedStatement pstatement = null;
- String query = "SELECT * FROM sterling_order WHERE employeeId = ?";
- employee_id = request.getParameter("employeeId");
- PreparedStatement preparedStmt = connection.prepareStatement(query);
- preparedStmt.setString(1, employee_id);
- rs = preparedStmt.executeQuery();
- if (rs.isBeforeFirst()) {
- valid = true;
- }
- } catch (Exception e) {
- out.print("Error" + e);
- }
- %>
- <% if (!valid) {%>
- <p>Employee not found in record <a href="deliveryBoyInfo.html">Back</a></p>
- <% } else {%>
- <p>
- <table>
- <thead>
- <tr>
- <th>id</th>
- <th>OrderId</th>
- <th>customerId</th>
- <th>employeeId</th>
- <th>OrderDate</th>
- <th>RecipientName</th>
- <th>RecipientAddress</th>
- <th>RecipientCity</th>
- <th>CourierWeight</th>
- <th>CourierStatus</th>
- <th>Description</th>
- </tr>
- </thead>
- <tbody>
- <% while(rs.next()) { %>
- <tr>
- <td><%= rs.getString("id")%></td>
- <td><%= rs.getString("OrderId")%></td>
- <td><%= rs.getString("customerId")%></td>
- <td><%= rs.getString("employeeId")%></td>
- <td><%= rs.getString("OrderDate")%></td>
- <td><%= rs.getString("RecipientName")%></td>
- <td><%= rs.getString("RecipientAddress")%></td>
- <td><%= rs.getString("RecipientCity")%></td>
- <td><%= rs.getString("CourierWeight")%></td>
- <td><%= rs.getString("CourierStatus")%></td>
- <td><%= rs.getString("Description")%></td>
- </tr>
- <% } %>
- </tbody>
- </table>
- </p>
- <form name="DELIVERY BOY INFORMATION" action="DeliveryOfCourier.jsp" method="post">
- <br>
- <tr>
- <td> Order ID</td>
- <td>
- <select name="order_id" id="order_id" required>
- <% while(rs.next()) { %>
- <option value="<%= rs.getString("OrderId")%>"><%= rs.getString("RecipientName")%></option>
- <% } %>
- </select>
- <br>
- <td> Delivery Date</td>
- <td><input type="date" name="delivery_date" placeholder="Delivery Date" required></td>
- <br>
- <td> Status</td>
- <td>
- <select name="status" required>
- <option value="P">Payment Received</option>
- <option value="R">Refund</option>
- <option value="D">Delivered</option>
- </select>
- </td>
- <br>
- <td> Description</td>
- <td><textarea name="description" placeholder="Description" max="30"></textarea></td>
- <br>
- <%--hidden id--%>
- <input type="hidden" name="empID" value="<%= employee_id %>">
- </tr>
- <td>
- <button type="submit">SUBMIT</button>
- </td>
- <td><input type="reset" id="reset_form"></td>
- </form>
- <%
- //connection.close();
- } %>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
- <script>
- $(function ($) {
- $('#reset_form').click(function () {
- $('form').reset();
- });
- })
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement