Advertisement
Guest User

Untitled

a guest
Apr 26th, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.68 KB | None | 0 0
  1. <%--
  2. Document : DeliveryBoyInfo
  3. Created on : Apr 11, 2017, 1:20:12 AM
  4. Author : AlinIQin
  5. --%>
  6. <%@ page import="java.sql.*" %>
  7. <%@ page import="java.sql.Connection" %>
  8. <%@ page import="java.sql.DriverManager" %>
  9. <%@ page import="java.util.HashMap" %>
  10. <%@ page import="java.util.Map" %>
  11. <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
  12. <%@page contentType="text/html" pageEncoding="UTF-8" %>
  13. <!DOCTYPE html>
  14. <html>
  15. <head>
  16. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  17. <title>Delivery Boy Information</title>
  18. <style type="text/css">
  19. * {
  20. font-family: cursive;
  21. }
  22. body {
  23. background: pink;
  24. color: black;
  25. font-family: cursive;
  26.  
  27. }
  28. table, th, td {
  29. border: 1px solid black;
  30. text-align: center;
  31. }
  32. </style>
  33. </head>
  34. <body>
  35. <%
  36. Connection connection = null;
  37. boolean valid = false;
  38. ResultSet rs = null;
  39. String employee_id = null;
  40. // Map<String, String> list = new HashMap<String, String>();
  41. // ArrayList al = new ArrayList();
  42.  
  43. try {
  44. Class.forName("com.mysql.jdbc.Driver").newInstance();
  45. String connectionURL = "jdbc:mysql://127.0.0.1/projek1?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC";
  46.  
  47. connection = DriverManager.getConnection(connectionURL, "root", "");
  48. connection.createStatement();
  49.  
  50. PreparedStatement pstatement = null;
  51. String query = "SELECT * FROM sterling_order WHERE employeeId = ?";
  52.  
  53. employee_id = request.getParameter("employeeId");
  54. PreparedStatement preparedStmt = connection.prepareStatement(query);
  55. preparedStmt.setString(1, employee_id);
  56. rs = preparedStmt.executeQuery();
  57.  
  58. if (rs.isBeforeFirst()) {
  59. valid = true;
  60. }
  61.  
  62. } catch (Exception e) {
  63. out.print("Error" + e);
  64. }
  65. %>
  66.  
  67. <% if (!valid) {%>
  68. <p>Employee not found in record <a href="deliveryBoyInfo.html">Back</a></p>
  69. <% } else {%>
  70. <p>
  71. <table>
  72. <thead>
  73. <tr>
  74. <th>id</th>
  75. <th>OrderId</th>
  76. <th>customerId</th>
  77. <th>employeeId</th>
  78. <th>OrderDate</th>
  79. <th>RecipientName</th>
  80. <th>RecipientAddress</th>
  81. <th>RecipientCity</th>
  82. <th>CourierWeight</th>
  83. <th>CourierStatus</th>
  84. <th>Description</th>
  85. </tr>
  86. </thead>
  87. <tbody>
  88. <% while(rs.next()) { %>
  89. <tr>
  90. <td><%= rs.getString("id")%></td>
  91. <td><%= rs.getString("OrderId")%></td>
  92. <td><%= rs.getString("customerId")%></td>
  93. <td><%= rs.getString("employeeId")%></td>
  94. <td><%= rs.getString("OrderDate")%></td>
  95. <td><%= rs.getString("RecipientName")%></td>
  96. <td><%= rs.getString("RecipientAddress")%></td>
  97. <td><%= rs.getString("RecipientCity")%></td>
  98. <td><%= rs.getString("CourierWeight")%></td>
  99. <td><%= rs.getString("CourierStatus")%></td>
  100. <td><%= rs.getString("Description")%></td>
  101. </tr>
  102. <% } %>
  103. </tbody>
  104. </table>
  105. </p>
  106.  
  107. <form name="DELIVERY BOY INFORMATION" action="DeliveryOfCourier.jsp" method="post">
  108. <br>
  109. <tr>
  110. <td> Order ID</td>
  111. <td>
  112. <select name="order_id" id="order_id" required>
  113. <% while(rs.next()) { %>
  114. <option value="<%= rs.getString("OrderId")%>"><%= rs.getString("RecipientName")%></option>
  115. <% } %>
  116. </select>
  117. <br>
  118. <td> Delivery Date</td>
  119. <td><input type="date" name="delivery_date" placeholder="Delivery Date" required></td>
  120. <br>
  121. <td> Status</td>
  122. <td>
  123. <select name="status" required>
  124. <option value="P">Payment Received</option>
  125. <option value="R">Refund</option>
  126. <option value="D">Delivered</option>
  127. </select>
  128. </td>
  129. <br>
  130. <td> Description</td>
  131. <td><textarea name="description" placeholder="Description" max="30"></textarea></td>
  132. <br>
  133. <%--hidden id--%>
  134. <input type="hidden" name="empID" value="<%= employee_id %>">
  135. </tr>
  136. <td>
  137. <button type="submit">SUBMIT</button>
  138. </td>
  139. <td><input type="reset" id="reset_form"></td>
  140. </form>
  141. <%
  142. //connection.close();
  143. } %>
  144.  
  145.  
  146. <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  147. <script>
  148. $(function ($) {
  149. $('#reset_form').click(function () {
  150. $('form').reset();
  151. });
  152. })
  153. </script>
  154. </body>
  155. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement