Commit a48a7f23 by Yovan Martinez

Arreglado mensaje de envio de formulario postulante

parent 37137d0f
......@@ -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("<p>Record saved successfully!</p>");
out.print(" <div class=\"alert\">\n" +
" <span class=\"closebtn\" onclick=\"this.parentElement.style.display='none';\">&times;</span> \n" +
" <strong>Formulario Cargado!</strong> EXITOSAMENTE CARGADO\n" +
"</div>");
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(" <div class=\"alert info\">\n" +
" <span class=\"closebtn\" onclick=\"this.parentElement.style.display='none';\">&times;</span> \n" +
" <strong>Formulario ya Cargado!</strong> YA EXISTE EL FORMULARIO\n" +
"</div>");
request.getRequestDispatcher("formulario.jsp").include(request, response);
out.print("<div class='alert info''>");
out.print("<span class='closebtn'' onclick='this.parentElement.style.display='none';'>&times;</span>");
out.print("<strong>Formulario ya Cargado!</strong> YA EXISTE EL FORMULARIO");
out.print("</div>");
//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(" <div class=\"alert info error\">\n" +
" <span class=\"closebtn\" onclick=\"this.parentElement.style.display='none';\">&times;</span> \n" +
" <strong>Formulario ya Cargado!</strong> YA EXISTE EL FORMULARIO\n" +
out.print("<div class='alert info error'>" +
"<span class=\"closebtn\" onclick=\"this.parentElement.style.display='none';\">&times;</span> \n" +
"<strong>Formulario ya Cargado!</strong> YA EXISTE EL FORMULARIO\n" +
"</div>");
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){
......
......@@ -42,10 +42,10 @@ pageEncoding="UTF-8"%>
</p>
<p class="enter">Si sigues interesado y cumples con los requisitos, completa el siguiente formulario: </p>
<form method="post" action="SaveServlet" class="form">
<form method="get" action="SaveServlet" class="form">
<input type="hidden" name="bootcamp_id" value="<%= request.getParameter("bootcamp") %>">
<input type="hidden" name="bootcamp" value="<%= request.getParameter("bootcamp") %>">
<label for="nombre">Ingrese su Nombre:</label>
<input required id="nombre" name="nombre" type="text"><br>
......
......@@ -68,7 +68,7 @@
<p data-block-key="cwggy">Es un campo de entrenamiento intensivo y gratuito para principiantes que ya programan y quieren ser parte de la empresa</p>
</div>
<div class="postulacion">
<a href="formulario.jsp"><button type="submit" class="cta-main">POSTULACION</button></a>
<a href="bootcamp.jsp"><button type="submit" class="cta-main">POSTULACION</button></a>
<!-- <a href="/postulacion" class="cta-main">POSTULACION</a> -->
</div>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment