Advertisement
Guest User

Untitled

a guest
Jun 16th, 2016
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. <%@ page import="java.sql.*" %>
  2. <%ResultSet resultset =null;%>
  3.  
  4. <HTML>
  5. <HEAD>
  6. <TITLE>Select element drop down box</TITLE>
  7. </HEAD>
  8.  
  9. <BODY>
  10.  
  11. <h1>ACME LIMITED</h1><br>
  12.  
  13. <h2>EMPLOYEE DETAILS</h2>
  14. <br>
  15. <form action = "Form.jsp">
  16. <button type = "submit">Add New Employee</button>
  17. </form>
  18. <%
  19. try{
  20. Class.forName("com.mysql.jdbc.Driver").newInstance();
  21.  
  22. Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/hirarchy_check","root","root@123");
  23.  
  24. Statement statement = connection.createStatement() ;
  25.  
  26. resultset =statement.executeQuery("select * from employee_details") ;
  27.  
  28. %>
  29. <table border = 1>
  30. <tr><th>Employee Id</th><th>Employee Name</th><th>Employee Designation</th><th>Reporting Manager</th><th>View</th></tr>
  31.  
  32. <%
  33. while(resultset.next())
  34. { %>
  35. <tr><td><%=resultset.getInt(1)%></td><td><%=resultset.getString(2)%></td><td><%=resultset.getString(3)%></td><td><%=resultset.getString(4)%></td><td><a href = 'FormUpdate.jsp'>View</a></td></tr>
  36. <% }%>
  37. </table>
  38.  
  39. <% }
  40. catch(Exception e)
  41. {
  42. out.println(e);
  43. }
  44. %>
  45.  
  46. </BODY>
  47. </HTML>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement