Below is my code on NetBeans "index.jsp". The table headers are formed but no data is shown, although MySQL database is connected. I have also included a mysql connector in the libraries so I ran out of possible problems.
<html> <body>
<table align="center" cellpadding="5" cellspacing="5" border="1">
<tr>
<th>First Name</th>
<th>Last Name</th>
</tr>
<%
try{
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/users", "root", "pass");
Statement statement=connection.createStatement();
String sql ="SELECT * FROM column_name";
ResultSet resultSet = statement.executeQuery(sql);
while(resultSet.next()){
%>
<td><%=resultSet.getString("Fname") %></td>
<td><%=resultSet.getString("Lname") %></td>
<%
}
connection.close();
} catch (Exception e) {
e.printStackTrace();
}
%>
</table>
</body></html>