diff --git a/.idea/misc.xml b/.idea/misc.xml
index 8bb1e38..5b6a5c4 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -10,7 +10,7 @@
-
+
\ No newline at end of file
diff --git a/src/main/java/com/roshka/proyectofinal/bootcamp/BootcampDao.java b/src/main/java/com/roshka/proyectofinal/bootcamp/BootcampDao.java
index 7678fbd..e56c1dd 100644
--- a/src/main/java/com/roshka/proyectofinal/bootcamp/BootcampDao.java
+++ b/src/main/java/com/roshka/proyectofinal/bootcamp/BootcampDao.java
@@ -120,6 +120,7 @@ public class BootcampDao {
PreparedStatement ps=con.prepareStatement("select * from bootcamp where id=?");
ps.setInt(1,id);
ResultSet rs=ps.executeQuery();
+ System.out.println();
if(rs.next()){
b.setId(rs.getInt("id"));
b.setActivo(rs.getBoolean("activo"));
@@ -136,4 +137,57 @@ public class BootcampDao {
return b;
}
+ public static List filtrar(String lenguaje){
+ ArrayList list = new ArrayList<>();
+// String sql = "select a.id, a.titulo, a.descripcion, a.fecha_inicio, a.fecha_fin, b.nombre_lenguaje, c.nombre,c.apellido, a.activo\n" +
+// "\tfrom bootcamp a\n" +
+// "\tinner join lenguaje b on b.id=a.id_lenguaje\n" +
+// "\tinner join profesor c on c.id=a.id_profesor\n" +
+// "\twhere a.fecha_inicio ilike ? and\n" +
+// "\ta.fecha_fin ilike ? and b.nombre_lenguaje ilike ?";
+
+
+
+ try{
+ Connection con= DataBase.getConnection();
+ //PreparedStatement ps=con.prepareStatement("");
+// PreparedStatement ps = con.prepareStatement("select a.id, a.titulo, a.descripcion, cast (a.fecha_inicio AS varchar) as fecha_inicio, cast (a.fecha_fin AS varchar) as fecha_fin, b.nombre_lenguaje, c.nombre,c.apellido, a.activo\n" +
+// "\tfrom bootcamp a\n" +
+// "\tinner join lenguaje b on b.id=a.id_lenguaje\n" +
+// "\tinner join profesor c on c.id=a.id_profesor\n" +
+// "\twhere a.fecha_inicio = ? and\n" +
+// "\ta.fecha_fin = ? and b.nombre_lenguaje = ?");
+ PreparedStatement ps = con.prepareStatement("select a.id, a.titulo, a.descripcion, cast (a.fecha_inicio AS varchar) as fecha_inicio, cast (a.fecha_fin AS varchar) as fecha_fin, b.nombre_lenguaje, c.nombre,c.apellido, a.activo\n" +
+ "\tfrom bootcamp a\n" +
+ "\tinner join lenguaje b on b.id=a.id_lenguaje\n" +
+ "\tinner join profesor c on c.id=a.id_profesor\n" +
+ " where b.nombre_lenguaje = ?");
+
+// ps.setString(1, fecha_inicio);
+// ps.setString(2, fecha_fin);
+ ps.setString(1, lenguaje);
+ ResultSet rs = ps.executeQuery();
+
+ while(rs.next()){
+ Bootcamp boot = new Bootcamp();
+
+ boot.setId(rs.getInt("id"));
+ boot.setActivo(rs.getBoolean("activo"));
+ boot.setDescripcion(rs.getString("descripcion"));
+ boot.setTitulo(rs.getString("titulo"));
+ boot.setFecha_fin(rs.getString("fecha_fin"));
+ boot.setFecha_inicio(rs.getString("fecha_inicio"));
+ boot.setNombre_profesor(rs.getString("nombre"));
+ boot.setApellido_profesor(rs.getString("apellido"));
+ boot.setNombre_lenguaje(rs.getString("nombre_lenguaje"));
+
+ list.add(boot);
+ }
+
+ con.close();
+ } catch (SQLException e) {
+ throw new RuntimeException(e);
+ }
+ return list;
+ }
}
diff --git a/src/main/java/com/roshka/proyectofinal/bootcamp/DeleteServlet.java b/src/main/java/com/roshka/proyectofinal/bootcamp/DeleteServlet.java
index 59b883e..d54e2c3 100644
--- a/src/main/java/com/roshka/proyectofinal/bootcamp/DeleteServlet.java
+++ b/src/main/java/com/roshka/proyectofinal/bootcamp/DeleteServlet.java
@@ -12,6 +12,7 @@ public class DeleteServlet extends HttpServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String sid=request.getParameter("id");
+
int id=Integer.parseInt(sid);
System.out.println("Este es el id " + id);
BootcampDao.delete(id);
diff --git a/src/main/java/com/roshka/proyectofinal/bootcamp/EditServlet.java b/src/main/java/com/roshka/proyectofinal/bootcamp/EditServlet.java
index a9acd3a..77d79ca 100644
--- a/src/main/java/com/roshka/proyectofinal/bootcamp/EditServlet.java
+++ b/src/main/java/com/roshka/proyectofinal/bootcamp/EditServlet.java
@@ -27,6 +27,7 @@ public class EditServlet extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
+
int id_lenguaje= Integer.parseInt(request.getParameter("id_lenguaje2"));
int id_profesor= Integer.parseInt(request.getParameter("id_profesor2"));
String fecha_inicio=request.getParameter("fecha_inicio2");
diff --git a/src/main/java/com/roshka/proyectofinal/profesor/Filtros.java b/src/main/java/com/roshka/proyectofinal/profesor/Filtros.java
index 096a482..113cf53 100644
--- a/src/main/java/com/roshka/proyectofinal/profesor/Filtros.java
+++ b/src/main/java/com/roshka/proyectofinal/profesor/Filtros.java
@@ -25,15 +25,12 @@ public class Filtros extends HttpServlet {
System.out.println(apellido);
if(nombre!=null || apellido!=null){
-
profesores = buscarPorNombre(nombre, apellido);
}
-
req.getServletContext().setAttribute("profesores", profesores);
RequestDispatcher reqDisp= req.getRequestDispatcher("profesor-consulta.jsp");
reqDisp.forward(req,resp);
}
-
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
List nombre = listarProfesor();
diff --git a/src/main/java/com/roshka/proyectofinal/profesor/ProfesorDao.java b/src/main/java/com/roshka/proyectofinal/profesor/ProfesorDao.java
index 4013f03..f96f126 100644
--- a/src/main/java/com/roshka/proyectofinal/profesor/ProfesorDao.java
+++ b/src/main/java/com/roshka/proyectofinal/profesor/ProfesorDao.java
@@ -58,7 +58,7 @@ public class ProfesorDao {
Profesor profesorObject = new Profesor();
try{
Connection con= DataBase.getConnection();
- PreparedStatement ps=con.prepareStatement("select a.id, a.nombre, a.apellido, a.nro_cedula, a.correo from profesor a " +
+ PreparedStatement ps=con.prepareStatement("select a.id, a.nombre, a.apelli do, a.nro_cedula, a.correo from profesor a " +
" where a.nombre ilike ? and a.apellido ilike ? ");
diff --git a/src/main/webapp/bootcamp.jsp b/src/main/webapp/bootcamp.jsp
index 87c0f55..cfe16bd 100644
--- a/src/main/webapp/bootcamp.jsp
+++ b/src/main/webapp/bootcamp.jsp
@@ -540,7 +540,7 @@ pageEncoding="UTF-8"%>
<%=rs.getString("fecha_fin")%>
diff --git a/src/main/webapp/formulario_bootcamp.jsp b/src/main/webapp/formulario_bootcamp.jsp
index cc4cccb..b46ced0 100644
--- a/src/main/webapp/formulario_bootcamp.jsp
+++ b/src/main/webapp/formulario_bootcamp.jsp
@@ -1,4 +1,4 @@
-<%@ page import="com.roshka.proyectofinal.entity.Lenguaje, com.roshka.proyectofinal.entity.Bootcamp, com.roshka.proyectofinal.lenguaje.LenguajeDao, com.roshka.proyectofinal.bootcamp.BootcampDao, com.roshka.proyectofinal.entity.Profesor, com.roshka.proyectofinal.profesor.ProfesorDao, java.util.List,java.util.Iterator, java.util.ArrayList, jakarta.servlet.http.* , java.lang.Object" %>
+<%@ page import="com.roshka.proyectofinal.entity.Lenguaje, com.roshka.proyectofinal.entity.Bootcamp, com.roshka.proyectofinal.lenguaje.LenguajeDao, com.roshka.proyectofinal.bootcamp.BootcampDao, com.roshka.proyectofinal.entity.Profesor, com.roshka.proyectofinal.profesor.ProfesorDao, java.util.List,java.util.Iterator, java.util.ArrayList, jakarta.servlet.http.* , java.lang.Object,jakarta.servlet.http.HttpServlet,jakarta.servlet.http.HttpServletRequest,java.sql.ResultSet" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
@@ -77,17 +77,46 @@
+
+
+ <%@page import="jakarta.servlet.http.HttpServlet,jakarta.servlet.http.HttpServletRequest,com.roshka.proyectofinal.bootcamp.BootcampDao"%>
+ <%
+ int nahuel = 0;
+ if(request.getParameter("filtraryovan")!=null){
+ if(request.getParameter("lenguaje") != null){
+ nahuel=1;
+ }
+ }
+ BootcampDao bootDao = new BootcampDao();
+ List listBoot;
+ listBoot = bootDao.listar();
+ String lenguaje = request.getParameter("lenguaje");
+ //String inicio = request.getParameter("fecha_inicio");
+ //String fin = request.getParameter("fecha_fin");
+ switch(nahuel){
+ case 1:
+ lenguaje = request.getParameter("lenguaje");
+ //inicio = request.getParameter("fecha_inicio");
+ //fin = request.getParameter("fecha_fin");
+ listBoot = bootDao.filtrar(lenguaje);
+ break;
+ case 0:
+ listBoot = bootDao.listar();
+ break;
+ }
+ Iterator iterBoot = listBoot.iterator();
+ Bootcamp boot = null;
+ %>
+
-
+ <%=nahuel%> <%=lenguaje%>
- <%
- BootcampDao bootDao = new BootcampDao();
- List
listBoot = bootDao.listar();
- Iterator iterBoot = listBoot.iterator();
- Bootcamp boot = null;
- %>
+
+
+
+