tenho uma BD como fazer uma lista de dados
esse é o meu codigo
<%@page contentType=“text/html”%>
<%@page pageEncoding=“UTF-8”%>
<%@ page import =
“javax.swing.JOptionPane,java.io.,java.util.,java.net.,java.sql.,javax.servlet.,javax.servlet.http.;”%>
<h1>GRAVA USUARIOS </h1>
<%
try {
Class.forName("com.mysql.jdbc.Driver");
Connection conn =
DriverManager.getConnection
("jdbc:mysql://localhost/bd?user=root&password=");
Statement st = conn.createStatement();
st.executeQuery(
" SELECT * FROM USUARIO" );
st.close();
JOptionPane.showMessageDialog(null,"OK", "", JOptionPane.PLAIN_MESSAGE);
}
catch (SQLException s) {
JOptionPane.showMessageDialog(null,"Erro no Cadastro ! ", "", JOptionPane.PLAIN_MESSAGE);
System.out.println("SQL Error: " + s.toString() + " "
+ s.getErrorCode() + " " + s.getSQLState());
} catch (Exception e) {
JOptionPane.showMessageDialog(null,"Dados Gravados com Sucesso ! ", "", JOptionPane.PLAIN_MESSAGE);
System.out.println("Error: " + e.toString()
+ e.getMessage());
}
%>
</body>