Advertisement
Guest User

Untitled

a guest
Jan 9th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.34 KB | None | 0 0
  1. <%@page import="com.sun.xml.internal.txw2.Document"%>
  2. <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
  3. pageEncoding="ISO-8859-1"%>
  4. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  5.  
  6. <html lang="en">
  7. <head>
  8. <%@ page import = "java.io.*,java.util.*,java.sql.*"%>
  9. <title>IFMR</title>
  10. <meta charset="utf-8">
  11. <meta name="viewport" content="width=device-width, initial-scale=1">
  12. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css">
  13. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  14. <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.6/umd/popper.min.js"></script>
  15. <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js"></script>
  16. <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
  17. <link rel="stylesheet" href="blade-pagination.css">
  18. <script src="jquery.blade-pagination.js"></script>
  19. <script src="//code.jquery.com/jquery-1.11.2.min.js"></script>
  20. <script src="jquery.simplePagination.js"></script>
  21.  
  22. <script type="text/javascript">
  23. function run()
  24. {
  25.  
  26.  
  27. var e = document.getElementById("sel1");
  28. var strUser = e.options[e.selectedIndex].value;
  29. document.getElementById('optval').value=strUser;
  30. alert ('strUser'+document.getElementById('optval').value);
  31. document.getElementById('s').submit();
  32. }
  33.  
  34. </script>
  35. <script >
  36. $("#example").simplePagination({
  37.  
  38. // the number of rows to show per page
  39. perPage: 5,
  40.  
  41. // CSS classes to custom the pagination
  42. containerClass: '',
  43. previousButtonClass: '',
  44. nextButtonClass: '',
  45.  
  46. // text for next and prev buttons
  47. previousButtonText: 'Previous',
  48. nextButtonText: 'Next',
  49.  
  50. // initial page
  51. currentPage: 1
  52.  
  53. });
  54.  
  55. </script>
  56. </head>
  57. <body>
  58. <div class="container">
  59. <h2>IFMR EMPLOYEE DB</h2>
  60.  
  61. <form id="s" method="post">
  62. <div class="form-group">
  63. <label for="sel">Select Dept:</label>
  64. <input type="hidden" id="optval" name="optval">
  65. <select class="form-control" id="sel1" onchange="javascript:run();">
  66. <option value = "-1"> </option>
  67. <option>IR</option>
  68. <option>Origination</option>
  69. <option>Treasury</option>
  70. </select>
  71. <br>
  72. <div>
  73. <table class = "table table-striped" id=demo1>
  74. <caption>Emp Details</caption>
  75.  
  76. <thead>
  77. <tr>
  78. <th>Dept</th>
  79. <th>Salutation</th>
  80. <th>First Name</th>
  81. <th>Last Name</th>
  82. <th>Organization</th>
  83. <th>Designation</th>
  84. <th>Email Address</th>
  85. <th>Mailing Address</th>
  86. </tr>
  87. </thead>
  88. <%
  89. System.out.println("opt>>>>>>>>>>>"+request.getParameter("optval"));
  90. try
  91. {
  92.  
  93. Class.forName("com.mysql.jdbc.Driver").newInstance();
  94. Connection con = (Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/ashok","root","");
  95. Statement stmt = con.createStatement();
  96. ResultSet rs =stmt.executeQuery("select * from ifmrdb1 where Dept='"+request.getParameter("optval")+"'");
  97. while(rs.next()){ %>
  98. <tr>
  99. <td> <center><%=rs.getString(1)%></center></td>
  100. <td> <center><%=rs.getString(2)%></center></td>
  101. <td> <center><%=rs.getString(3)%></center></td>
  102. <td> <center><%=rs.getString(4)%></center></td>
  103. <td> <center><%=rs.getString(5)%></center></td>
  104. <td> <center><%=rs.getString(6)%></center></td>
  105. <td> <center><%=rs.getString(7)%></center></td>
  106. <td> <center><%=rs.getString(8)%></center></td>
  107. </tr>
  108. <%}
  109. }
  110. catch(Exception ex){
  111. ex.printStackTrace();
  112. }
  113. %>
  114. <tbody>
  115. <tr>
  116.  
  117. </tr>
  118. </tbody>
  119.  
  120. </table>
  121. </div>
  122. </div>
  123. </form>
  124. </div>
  125. </body>
  126. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement