diff --git a/.gitignore b/.gitignore index 16d6d53..e1eb7a2 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ target/ ### IntelliJ IDEA ### .idea/gitmisc.xml .idea/encodings.xml +.idea/misc.xml .idea/** .idea/modules.xml .idea/jarRepositories.xml @@ -14,6 +15,7 @@ target/ *.iws *.iml *.ipr + /encodings.xml ### Eclipse ### .apt_generated diff --git a/src/main/java/com/roshka/proyectofinal/Postulante/Filtros.java b/src/main/java/com/roshka/proyectofinal/Postulante/Filtros.java index cb976c8..b6a5113 100644 --- a/src/main/java/com/roshka/proyectofinal/Postulante/Filtros.java +++ b/src/main/java/com/roshka/proyectofinal/Postulante/Filtros.java @@ -20,10 +20,11 @@ public class Filtros extends HttpServlet { protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { List postulantes = listarPostulante(); String respuesta = req.getParameter("id"); - boolean valor = Boolean.parseBoolean(req.getParameter("valor")); + String valor = req.getParameter("valor"); String nombre = req.getParameter("nombreBuscar")== null ? "0" : req.getParameter("nombreBuscar"); - System.out.println(nombre); if(respuesta != null) { + System.out.println(valor); + System.out.println(respuesta); update(Integer.parseInt(req.getParameter("id")), valor); postulantes = listarPostulante(); } else if(nombre.length() > 1){ diff --git a/src/main/java/com/roshka/proyectofinal/Postulante/PostulanteDao.java b/src/main/java/com/roshka/proyectofinal/Postulante/PostulanteDao.java index 055fcce..8dc90a5 100644 --- a/src/main/java/com/roshka/proyectofinal/Postulante/PostulanteDao.java +++ b/src/main/java/com/roshka/proyectofinal/Postulante/PostulanteDao.java @@ -72,30 +72,20 @@ import java.util.List; return postulante; } - public static void update(int id, Boolean valor) { - if (valor == true) { + public static void update(int id, String valor) { + boolean v = valor.equals("0") ? false : true; + try { Connection con = DataBase.getConnection(); - PreparedStatement ps = con.prepareStatement("update postulante set aceptado= false\n" + - "where id=?"); - ps.setInt(1, id); + PreparedStatement ps = con.prepareStatement("update postulante set aceptado= ? where id=?"); + ps.setBoolean(1, v); + ps.setInt(2, id); ps.executeUpdate(); con.close(); - } catch (Exception ex) { - ex.printStackTrace(); } - } else { - try { - Connection con = DataBase.getConnection(); - PreparedStatement ps = con.prepareStatement("update postulante set aceptado= true\n" + - "where id=?"); - ps.setInt(1, id); - ps.executeUpdate(); - con.close(); - } catch (Exception ex) { + catch (Exception ex) { ex.printStackTrace(); } - } } diff --git a/src/main/java/com/roshka/proyectofinal/Postulante/SaveServlet.java b/src/main/java/com/roshka/proyectofinal/Postulante/SaveServlet.java index fa854ea..a1bd41d 100644 --- a/src/main/java/com/roshka/proyectofinal/Postulante/SaveServlet.java +++ b/src/main/java/com/roshka/proyectofinal/Postulante/SaveServlet.java @@ -4,6 +4,7 @@ import com.roshka.proyectofinal.DataBase; import com.roshka.proyectofinal.entity.Postulante; import com.roshka.proyectofinal.entity.Bootcamp; import com.roshka.proyectofinal.entity.PostulanteLenguaje; +import jakarta.servlet.RequestDispatcher; import jakarta.servlet.ServletException; import jakarta.servlet.annotation.WebServlet; import jakarta.servlet.http.HttpServlet; @@ -18,13 +19,13 @@ import java.sql.Statement; @WebServlet("/SaveServlet") public class SaveServlet extends HttpServlet { - protected void doPost(HttpServletRequest request, HttpServletResponse response) + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out=response.getWriter(); boolean rechazarDatos = false; - int bootcampActual = Integer.parseInt(request.getParameter("bootcamp_id")); + int bootcampActual = Integer.parseInt(request.getParameter("bootcamp")); try { Connection con = DataBase.getConnection(); @@ -107,25 +108,38 @@ public class SaveServlet extends HttpServlet { } if(status>0){ //out.print("

Record saved successfully!

"); + out.print("
\n" + " × \n" + " Formulario Cargado! EXITOSAMENTE CARGADO\n" + "
"); - request.getRequestDispatcher("formulario.jsp").include(request, response); + request.setAttribute("bootcamp", bootcampActual); + RequestDispatcher rd = request.getRequestDispatcher("formulario.jsp"); + rd.include(request, response); + //RequestDispatcher rd = request.getRequestDispatcher("formulario.jsp"); + //rd.include(request, response); }else{ if (rechazarDatos){ - out.print("
\n" + - " × \n" + - " Formulario ya Cargado! YA EXISTE EL FORMULARIO\n" + - "
"); - request.getRequestDispatcher("formulario.jsp").include(request, response); + + out.print("
"); + out.print("×"); + out.print("Formulario ya Cargado! YA EXISTE EL FORMULARIO"); + out.print("
"); + //request.getRequestDispatcher("formulario.jsp").include(request, response); + request.setAttribute("bootcamp", bootcampActual); + RequestDispatcher rd = request.getRequestDispatcher("formulario.jsp"); + rd.include(request, response); }else { + out.println("Error al cargar datos"); - out.print("
\n" + - " × \n" + - " Formulario ya Cargado! YA EXISTE EL FORMULARIO\n" + + out.print("
" + + "× \n" + + "Formulario ya Cargado! YA EXISTE EL FORMULARIO\n" + "
"); - request.getRequestDispatcher("formulario.jsp").include(request, response); + request.setAttribute("bootcamp", bootcampActual); + RequestDispatcher rd = request.getRequestDispatcher("formulario.jsp"); + rd.include(request, response); + //request.getRequestDispatcher("formulario.jsp").include(request, response); } } }catch (Exception ex){ diff --git a/src/main/java/com/roshka/proyectofinal/login/LoginServlet.java b/src/main/java/com/roshka/proyectofinal/login/LoginServlet.java index 7d797f9..028df26 100644 --- a/src/main/java/com/roshka/proyectofinal/login/LoginServlet.java +++ b/src/main/java/com/roshka/proyectofinal/login/LoginServlet.java @@ -78,7 +78,7 @@ public class LoginServlet extends HttpServlet { catch (Exception ignored) { } // Si no es posible redireccionar a la pagina solicitada, llevar a la main page - RequestDispatcher rd = request.getRequestDispatcher("menu.html"); + RequestDispatcher rd = request.getRequestDispatcher("menu.jsp"); rd.include(request,response); } else { diff --git a/src/main/webapp/form.css b/src/main/webapp/form.css index fbcfa77..d937a06 100644 --- a/src/main/webapp/form.css +++ b/src/main/webapp/form.css @@ -12,9 +12,10 @@ body{ display: flex; justify-content: center; align-items: center; - height: 160%;} - + height: 160%; } + + /* para el logo */ img{ width: 165px; @@ -136,4 +137,4 @@ width:500px; .closebtn:hover { color: black; -} +} \ No newline at end of file diff --git a/src/main/webapp/formulario.jsp b/src/main/webapp/formulario.jsp index 92aed46..dfde7cb 100644 --- a/src/main/webapp/formulario.jsp +++ b/src/main/webapp/formulario.jsp @@ -2,8 +2,6 @@ pageEncoding="UTF-8"%> <%@ page import="java.sql.*,java.sql.Connection,java.sql.ResultSet,com.roshka.proyectofinal.DataBase,jakarta.servlet.http.HttpServlet,jakarta.servlet.http.HttpServletRequest"%> - - @@ -16,7 +14,6 @@ pageEncoding="UTF-8"%> Formulario Postulante - @@ -42,10 +39,9 @@ pageEncoding="UTF-8"%>

Si sigues interesado y cumples con los requisitos, completa el siguiente formulario:

-
- + - "> + ">
@@ -101,9 +97,11 @@ pageEncoding="UTF-8"%>
volver
+
+