Advertisement
Guest User

Untitled

a guest
Apr 26th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.05 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.  
  42. try {
  43. Class.forName("com.mysql.jdbc.Driver").newInstance();
  44. String connectionURL = "jdbc:mysql://127.0.0.1/projek1?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC";
  45.  
  46. connection = DriverManager.getConnection(connectionURL, "root", "");
  47. connection.createStatement();
  48.  
  49. PreparedStatement pstatement = null;
  50. String query = "SELECT * FROM sterling_order WHERE employeeId = ?";
  51.  
  52. employee_id = request.getParameter("employeeId");
  53. PreparedStatement preparedStmt = connection.prepareStatement(query);
  54. preparedStmt.setString(1, employee_id);
  55. rs = preparedStmt.executeQuery();
  56.  
  57. if (!rs.isBeforeFirst()) {
  58. request.setAttribute("rs", rs);
  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. <tr>
  89. <c:forEach items="${sterlingOrders.next()}" var="item">
  90. <td>${item.id}</td>
  91. </c:forEach>
  92. </tr>
  93. </tbody>
  94. </table>
  95. </p>
  96.  
  97. <form name="DELIVERY BOY INFORMATION" action="DeliveryOfCourier.jsp" method="post">
  98. <br>
  99. <tr>
  100. <td> Order ID</td>
  101. <td>
  102. <select name="order_id" id="order_id" required>
  103. <%--sini ade loop option id dan value--%>
  104. </select>
  105. <br>
  106. <td> Delivery Date</td>
  107. <td><input type="date" name="delivery_date" placeholder="Delivery Date" required></td>
  108. <br>
  109. <td> Status</td>
  110. <td>
  111. <select name="status" required>
  112. <option value="P">Payment Received</option>
  113. <option value="R">Refund</option>
  114. <option value="D">Delivered</option>
  115. </select>
  116. </td>
  117. <br>
  118. <td> Description</td>
  119. <td><textarea name="description" placeholder="Description" max="30"></textarea></td>
  120. <br>
  121. <%--hidden id--%>
  122. <input type="hidden" name="empID" value="<%= employee_id %>">
  123. </tr>
  124. <td>
  125. <button type="submit">SUBMIT</button>
  126. </td>
  127. <td><input type="reset" id="reset_form"></td>
  128. </form>
  129. <%
  130. connection.close();
  131. } %>
  132.  
  133.  
  134. <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  135. <script>
  136. $(function ($) {
  137. $('#reset_form').click(function () {
  138. $('form').reset();
  139. });
  140. })
  141. </script>
  142. </body>
  143. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement