Olá pessoal tudo bom??
Bom estou com a seguinte duvida:
No meu DAO tenho um metodo procura:
public Fabricante procura(Long idFabricante) throws SQLException {
Fabricante fabricante = new Fabricante();
Connection con = ConnectionFactory.getConnection();
PreparedStatement stmt = con.prepareStatement("select co_fabricante,ds_fabricante,st_fabricante from tb_fabricante where co_fabricante=?");
stmt.setLong(1,idFabricante);
ResultSet rs = stmt.executeQuery();
if (!rs.next())
return null;
fabricante.setNomeFabricante(rs.getString("ds_fabricante"));
rs.close();
stmt.close();
return fabricante;
}
Entao no meu JSP estou passando o parametro “idFabricante” para meu Controller para ele passar para o DAO mas nao esta dando certo. Esta dando erro.
private static final long serialVersionUID = 5768620368959587794L;
protected void doGet(HttpServletRequest rqt, HttpServletResponse rsp)throws ServletException, IOException {
String idFabricante = rqt.getParameter("idFabricante");
Fabricante fabricante = new Fabricante();
fabricante.setIdFabricante(new Long(idFabricante));
try {
FabricanteDAO.procura(fabricante);
} catch (SQLException e) {
e.printStackTrace();
System.out.println("Erro: " + e.getMessage());
}
RequestDispatcher view = rqt.getRequestDispatcher("/jsp/fabricante/altFabricante.jsp");
view.forward(rqt, rsp);
PrintWriter out = rsp.getWriter();
out.close();
}
}
Alguem consegue me ajudar nisso???