protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String id = request.getParameter("txtId");
String nombre = request.getParameter("txtNombre");
String direccion = request.getParameter("txtDireccion");
String telefono = request.getParameter("txtTelefono");
String idproveedor = request.getParameter("txtProveedor");
if(id.equals("")||nombre.equals("")||direccion.equals("")||telefono.equals("")||idproveedor.equals("")){
String error = "Complete los Campos";
request.getSession().setAttribute("error", error);
request.getRequestDispatcher("error.jsp").forward(request, response);
}
else{
Personal personal = new Personal();
personal.setPersonalPK(personalPK);
personal.setNompersonal(nombre);
personal.setDirpersonal(direccion);
personal.setTelpersonal(telefono);
personal.setProveedor(proveedor);
}
}
This is my code, I received from a page jsp the values of a form, which are the id, name, address, telephone and provider (it is the foreign key). the code marks me an error in the primary key since all data types are being handled as a string and in the id it expects a personalPK object and I want to add the id that is String. DO NOT ALLOW ME.