0
29kviews
Write a JSP program to read the students data like roll number, name, email and marks from the database and display it in tabular format on web page
1 Answer
0
1.6kviews

<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Student details </title> </head> <body>

</body>
<form method="post">
<table border="2">
<tr>
<td>ROLL NUMBER</td>
<td>NAME</td>
<td>EMAIL</td>
<td>MARKS</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("ROLL NUMBER …

Create a free account to keep reading this post.

and 3 others joined a min ago.

Please log in to add an answer.