Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%@page import="com.sun.xml.internal.txw2.Document"%>
- <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
- pageEncoding="ISO-8859-1"%>
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
- <html lang="en">
- <head>
- <%@ page import = "java.io.*,java.util.*,java.sql.*"%>
- <title>IFMR</title>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css">
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.6/umd/popper.min.js"></script>
- <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js"></script>
- <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
- <link rel="stylesheet" href="blade-pagination.css">
- <script src="jquery.blade-pagination.js"></script>
- <script src="//code.jquery.com/jquery-1.11.2.min.js"></script>
- <script src="jquery.simplePagination.js"></script>
- <script type="text/javascript">
- function run()
- {
- var e = document.getElementById("sel1");
- var strUser = e.options[e.selectedIndex].value;
- document.getElementById('optval').value=strUser;
- alert ('strUser'+document.getElementById('optval').value);
- document.getElementById('s').submit();
- }
- </script>
- <script >
- $("#example").simplePagination({
- // the number of rows to show per page
- perPage: 5,
- // CSS classes to custom the pagination
- containerClass: '',
- previousButtonClass: '',
- nextButtonClass: '',
- // text for next and prev buttons
- previousButtonText: 'Previous',
- nextButtonText: 'Next',
- // initial page
- currentPage: 1
- });
- </script>
- </head>
- <body>
- <div class="container">
- <h2>IFMR EMPLOYEE DB</h2>
- <form id="s" method="post">
- <div class="form-group">
- <label for="sel">Select Dept:</label>
- <input type="hidden" id="optval" name="optval">
- <select class="form-control" id="sel1" onchange="javascript:run();">
- <option value = "-1"> </option>
- <option>IR</option>
- <option>Origination</option>
- <option>Treasury</option>
- </select>
- <br>
- <div>
- <table class = "table table-striped" id=demo1>
- <caption>Emp Details</caption>
- <thead>
- <tr>
- <th>Dept</th>
- <th>Salutation</th>
- <th>First Name</th>
- <th>Last Name</th>
- <th>Organization</th>
- <th>Designation</th>
- <th>Email Address</th>
- <th>Mailing Address</th>
- </tr>
- </thead>
- <%
- System.out.println("opt>>>>>>>>>>>"+request.getParameter("optval"));
- try
- {
- Class.forName("com.mysql.jdbc.Driver").newInstance();
- Connection con = (Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/ashok","root","");
- Statement stmt = con.createStatement();
- ResultSet rs =stmt.executeQuery("select * from ifmrdb1 where Dept='"+request.getParameter("optval")+"'");
- while(rs.next()){ %>
- <tr>
- <td> <center><%=rs.getString(1)%></center></td>
- <td> <center><%=rs.getString(2)%></center></td>
- <td> <center><%=rs.getString(3)%></center></td>
- <td> <center><%=rs.getString(4)%></center></td>
- <td> <center><%=rs.getString(5)%></center></td>
- <td> <center><%=rs.getString(6)%></center></td>
- <td> <center><%=rs.getString(7)%></center></td>
- <td> <center><%=rs.getString(8)%></center></td>
- </tr>
- <%}
- }
- catch(Exception ex){
- ex.printStackTrace();
- }
- %>
- <tbody>
- <tr>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- </form>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement