THIS IS MY JSP "INSERT":
<%
ProfesionalBE profesional = new ProfesionalBE();
profesional.setNombre(request.getParameter("nombre"));
profesional.setApellido(request.getParameter("apellido"));
profesional.setCorreo(request.getParameter("correo"));
profesional.setId_nacionalidad(request.getParameter("idnacionalidad"));
int b = new ProfesionalBR().RegistrarProfesional(profesional)
%>
THIS IS MY DAO CLASS which calls when inserting:
public int InsertarProfesional(ProfesionalBE e){
int r =0;
Connection con = new Conexion().conectarSQL();
String sql = "INSERT INTO Tbl_Profesional (Nombre_profesional, Apellidos_profesional, Correo_profesional, id_Nacionalidad) "
+ "VALUES ('"+e.getNombre()+"','"+e.getApellido()+"','"+e.getCorreo()+"','"+e.getId_nacionalidad()+"')";
try {
Statement st = con.createStatement();
ResultSet rs = st.executeQuery(sql);
rs.next();
rs.close();
st.close();
con.close();
st=null;
} catch (SQLException ex) {
Logger.getLogger(ProfesionalDAO.class.getName()).log(Level.SEVERE, null, ex);
}
con=null;
return r;
}
My problem is that at the moment of inserting the DB I do not insert anything, because it does not read the id as a number, my query is how to get the id of a combobox with data displayed from a sql table to be able to register them in another table,