Estou tantando desenvolver um página simples de cadastro mais não estou conseguindo inserir os dados no banco.
abaixo tenho ao codigo do arquivo html:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Inserindo dados via JDBC com JSP</title>
</head>
<body>
<form action="inserir.jsp" method="post">
<table>
<tr>
<td>ISBN:</td><td><input type="text" name="isbn" /></td>
</tr>
<tr>
<td>Título:</td><td><input type="text" name="titulo" /></td>
</tr>
<tr>
<td>Edição:</td><td><input type="text" name="edicao" /></td>
</tr>
<tr>
<td>Publicação:</td><td><input type="text" name="publicacao" /></td>
</tr>
<tr>
<td>Descrição:</td>
<td><textarea name="descricao" rows="5" cols="25"></textarea></td>
</tr>
<tr>
<td colspan="2">
<input type="submit" name="btCadastrar" value="Enviar" />
</td>
</tr>
</table>
</form>
</body>
abaixo tenho o código do servlet NewServlet:
[code]public class NewServlet extends HttpServlet {
public void destroy(){
super.destroy();
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
String isbn = request.getParameter(“isbn”);
String titulo = request.getParameter(“titulo”);
String edicao = request.getParameter(“edicao”);
String publicacao = request.getParameter(“publicacao”);
String descricao = request.getParameter(“descricao”);
Connection conn = null;
PreparedStatement pst = null;
try {
Class.forName(“com.mysql.jdbc.Driver”).newInstance();
conn =
DriverManager.getConnection(“jdbc:mysql://localhost/livraria”,
“edson”,“integrator”);
String SQL = "INSERT INTO livros (isbn, titulo, edicao_num, " +
"ano_publicacao, descricao) " +
“values (?, ?, ?, ?, ?)”;
pst = conn.prepareStatement(SQL);
pst.setString(1, isbn);
pst.setString(2, titulo);
pst.setInt(3, Integer.parseInt(edicao));
pst.setString(4, publicacao);
pst.setString(5, descricao);
pst.executeUpdate();
pst.clearParameters();
} catch (Exception ex) {
ex.printStackTrace();
} finally {
try {
pst.close();
} catch (SQLException ex) {
Logger.getLogger(NewServlet.class.getName()).log(Level.SEVERE, null, ex);
}
try {
conn.close();
} catch (SQLException ex) {
Logger.getLogger(NewServlet.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
public void init()throws ServletException{
super.init();
}
}
[/code]
Qual o Erro da minha servlet?
agradeço desde ja
