formulario_bootcamp.jsp 10.7 KB
Newer Older
1
<%@ 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" %>
Jose Baez committed
2
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
Emanuel Lugo committed
3 4 5 6 7 8 9 10 11 12 13
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

        <%HttpSession session1 = request.getSession(true);
			Object done = session1.getAttribute("logon.isDone");
			 if (done == null) {
				session1.setAttribute("login.target", HttpUtils.getRequestURL(request).toString());
				response.sendRedirect(request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath() +"/login.jsp");
				return;

            }%>

14 15 16
    <!DOCTYPE html>
    <html>

17 18
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
19
        <link href="css/bootstrap.css" rel="stylesheet" type="text/css" />
Rebecca Arzamendia committed
20 21
         <!-- coneccion con el de css  -->
               <link rel="stylesheet" href="postulante.css">
22 23
        <title>JSP Page</title>
    </head>
24

25 26
    <body>
        <div class="container">
Rebecca Arzamendia committed
27
            <h1> CREAR BOOTCAMP </h1>
28

29
            <%@ 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" %>
30
                <%
31
             LenguajeDao lenDao = new LenguajeDao();
32 33 34
             List<Lenguaje> listLen = lenDao.listar();
             Iterator<Lenguaje> iter =  listLen.iterator();
             Lenguaje len = null;
35

36
             ProfesorDao profeDao = new ProfesorDao();
Angel Zarate committed
37
             List<Profesor> listProfesor = profeDao.listarProfesor();
38 39
             Iterator<Profesor> iterProfe =  listProfesor.iterator();
             Profesor profe = null;
40
             %>
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
                    <form action="SaveServletBootcamp" method="post">
                        <label for="titulo">titulo:</label>
                        <input type="text" name="titulo" id="titulo">
                        <label for="descripcion">descripcion:</label>
                        <input type="text" name="descripcion" id="descripcion">
                        <label for="fecha_inicio">fecha de inicio:</label>
                        <input type="text" name="fecha_inicio" id="fecha_inicio">
                        <label for="fecha_fin">fecha de fin:</label>
                        <input type="text" name="fecha_fin" id="fecha_fin">
                        <label for="activo">Activo:</label>
                        <input type="checkbox" name="activo" id="activo">
                        <label for="imagen">Imagen:</label>
                        <input type="text" name="imagen" id="imagen">
                        <label for="id_lenguaje">Lenguajes:</label>
                        <select name="id_lenguaje" id="id_lenguaje">
56 57 58 59
                    <% while(iter.hasNext()){
                        len = iter.next();
                    %>
                        <option value=<%= len.getId() %> >
60 61 62 63
                            <%= len.getNombre_lenguaje() %>
                        </option>
                        <% } %>
                    </select>
64

65 66
                    <label for="id_profesor">Profesores:</label>
                    <select name="id_profesor" id="id_profesor">
67 68 69 70 71 72 73
                    <% while(iterProfe.hasNext()){
                        profe = iterProfe.next();

                    %>
                        <option value=<%= profe.getId() %> >
                            <%= profe.getNombre() + " " + profe.getApellido() %>
                        </option>
74
                    <% } %>
75 76
                    </select>

77 78 79
                    <button type="submit">
                        Crear Bootcamp
                    </button>
80
                    
81
                </form>
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
                
                <%@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<Bootcamp> 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<Bootcamp> iterBoot = listBoot.iterator();
                Bootcamp boot = null;
                %>
111

112 113 114 115 116
        <form method="get" action ="#" >    
            <input name="lenguaje" type="search" placeholder="Buscar por lenguaje"></input>
            
            <input type="submit" name="filtraryovan" value= "Filtrar"></input>       
        </form>
117
        </div>
118
        <p><%=nahuel%> <%=lenguaje%>  </p>
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
        <div>
            <table>
              <thead>
                <tr>
                  <th>Titulo</th>
                  <th>Descripcion</th>
                  <th>fecha de Inicio</th>
                  <th>Fecha de Fin</th>
                  <th>Lenguaje</th>
                  <th>Profesor</th>
                  <th>Activo</th>
                </tr>
              </thead>
              <tbody>
                <% while(iterBoot.hasNext()){
                    boot = iterBoot.next();

                    %>
                    <tr>
                    <th> <%= boot.getTitulo() %> </th>
                    <th> <%= boot.getDescripcion() %> </th>
                    <th> <%= boot.getFecha_inicio() %> </th>
                    <th> <%= boot.getFecha_fin() %> </th>
                    <th> <%= boot.getNombre_lenguaje() %> </th>
                    <th> <%= boot.getNombre_profesor() + " " + boot.getApellido_profesor() %> </th>
                    <th> <%= boot.getActivo() %> </th>
145
                    <th>  <form action="EditServletBootcamp" method="get">
146
                            <input type="hidden" name="id" id="id" value=<%= boot.getId() %>>
147
                            <input type="submit" value="Editar" ></input>
148 149 150
                          </form>
                    </th>
                    <th>
151
                        <form action="DeleteServletBootcamp" method="get">
152
                            <input type="hidden" name="id" id="id" value= <%= boot.getId() %> >
153 154 155 156 157 158 159
                            <input type="submit" value="Borrar" > </input>
                        </form>
                    </th>
                    </tr>
                    <% } %>
              </tbody>
            </table>
160
                    </form>
161 162 163 164
                    



165
        </div>
166

167 168 169 170 171 172 173 174 175


        <%
                             LenguajeDao lenDao2 = new LenguajeDao();
                             List<Lenguaje> listLenguaje2 = lenDao2.listar();
                             Iterator<Lenguaje> iter2 =  listLenguaje2.iterator();
                             Lenguaje len2 = null;

                             ProfesorDao profeDao2 = new ProfesorDao();
Angel Zarate committed
176
                             List<Profesor> listProfesor2 = profeDao2.listarProfesor();
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225
                             Iterator<Profesor> iterProfe2 =  listProfesor2.iterator();
                             Profesor profe2 = null;
            Bootcamp bootcampToEdit = (Bootcamp)request.getAttribute("Bootcamp");
            if(bootcampToEdit != null){
        %>
            <form method="post" action="EditServletBootcamp">
                        <label for="titulo2">titulo:</label>
                        <input type="text" id="titulo2" name="titulo2" value="<%= bootcampToEdit.getTitulo() %>">
                        <label for="descripcion2">descripcion:</label>
                        <input type="text" id="descripcion2" name="descripcion2" value="<%= bootcampToEdit.getDescripcion() %>">
                        <label for="fecha_inicio2">fecha de inicio:</label>
                        <input type="text" id="fecha_inicio2" name="fecha_inicio2" value="<%= bootcampToEdit.getFecha_inicio() %>">
                        <label for="fecha_fin2">fecha de fin:</label>
                        <input type="text" id="fecha_fin2" name="fecha_fin2" value="<%= bootcampToEdit.getFecha_fin() %>">
                        <label for="activo2">Activo:</label>
                        <input type="checkbox" id="activo2" name="activo2">
                        <label for="imagen2">Imagen:</label>
                        <input type="text" name="imagen2" id="imagen2" value=<%= bootcampToEdit.getImagen() %>>
                        <input type="hidden" value=<%= bootcampToEdit.getId() %> name="id" id="id" />
                        <label for="id_lenguaje2">Lenguajes:</label>
                        <select name="id_lenguaje2" id="id_lenguaje2">
                        <% while(iter2.hasNext()){
                        len2 = iter2.next();
                        %>
                        <option value=<%= len2.getId() %> >
                            <%= len2.getNombre_lenguaje() %>
                        </option>
                        <% } %>
                        </select>

                        <label for="id_profesor2">Profesores:</label>
                        <select id="id_profesor2" name="id_profesor2">
                        <% while(iterProfe2.hasNext()){
                        profe2 = iterProfe2.next();

                        %>
                        <option value=<%= profe2.getId() %> >
                            <%= profe2.getNombre() + " " + profe2.getApellido() %>
                        </option>
                        <% } %>
                        </select>

                        <button type="submit">
                            Editar Bootcamp
                        </button>
            </form>
        <% } %>

    </body>
226
    </html>