Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
- <title>Insert title here</title>
- </head>
- <body>
- </body>
- <form method="post">
- <table border="2">
- <tr>
- <td>ID</td>
- <td>NAME</td>
- <td>SKILL</td>
- <td>ACTION</td>
- </tr>
- <%
- try
- {
- Class.forName("com.mysql.jdbc.Driver");
- String url="jdbc:mysql://localhost/test";
- String username="root";
- String password="root";
- String query="select * from jsp1";
- Connection conn=DriverManager.getConnection(url,username,password);
- Statement stmt=conn.createStatement();
- ResultSet rs=stmt.executeQuery(query);
- while(rs.next())
- {
- %>
- <tr><td><%rs.getInt("ID"); %></td></tr>
- <tr><td><%rs.getString("NAME"); %></td></tr>
- <tr><td><%rs.getString("SKILL"); %></td></tr>
- <%
- }
- %>
- </table>
- <%
- rs.close();
- stmt.close();
- conn.close();
- }
- catch(Exception e)
- {
- e.printStackTrace();
- }
- %>
- </form>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement