formulario_bootcamp.jsp 8.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" %>
Jose Baez committed
2
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
3
<%@ taglib uri = "http://java.sun.com/jsp/jstl/core" prefix = "c" %>
4 5 6
    <!DOCTYPE html>
    <html>

7 8
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
9
        <link href="css/bootstrap.css" rel="stylesheet" type="text/css" />
Rebecca Arzamendia committed
10 11
         <!-- coneccion con el de css  -->
               <link rel="stylesheet" href="postulante.css">
12 13
        <title>JSP Page</title>
    </head>
14

15 16
    <body>
        <div class="container">
Rebecca Arzamendia committed
17
            <h1> CREAR BOOTCAMP </h1>
18

19
            <%@ 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" %>
20
                <%
21 22 23 24
            LenguajeDao lenDao = new LenguajeDao();
             List<Lenguaje> listLen = lenDao.listar();
             Iterator<Lenguaje> iter =  listLen.iterator();
             Lenguaje len = null;
25

26
             ProfesorDao profeDao = new ProfesorDao();
Angel Zarate committed
27
             List<Profesor> listProfesor = profeDao.listarProfesor();
28 29
             Iterator<Profesor> iterProfe =  listProfesor.iterator();
             Profesor profe = null;
30
             %>
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
                    <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">
46 47 48 49
                    <% while(iter.hasNext()){
                        len = iter.next();
                    %>
                        <option value=<%= len.getId() %> >
50 51 52 53
                            <%= len.getNombre_lenguaje() %>
                        </option>
                        <% } %>
                    </select>
54

55 56
                    <label for="id_profesor">Profesores:</label>
                    <select name="id_profesor" id="id_profesor">
57 58 59 60 61 62 63
                    <% while(iterProfe.hasNext()){
                        profe = iterProfe.next();

                    %>
                        <option value=<%= profe.getId() %> >
                            <%= profe.getNombre() + " " + profe.getApellido() %>
                        </option>
64
                    <% } %>
65 66
                    </select>

67 68 69 70
                    <button type="submit">
                        Crear Bootcamp
                    </button>
                </form>
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105

        </div>

        <div>
            <%
                BootcampDao bootDao = new BootcampDao();
                List<Bootcamp> listBoot = bootDao.listar();
                Iterator<Bootcamp> iterBoot =  listBoot.iterator();
                Bootcamp boot = null;
            %>
            <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>
106
                    <th>  <form action="EditServletBootcamp" method="get">
107
                            <input type="hidden" name="id" value=<%= boot.getId() %>>
108
                            <input type="submit" value="Editar" ></input>
109 110 111
                          </form>
                    </th>
                    <th>
112
                        <form action="DeleteServletBootcamp" method="get">
113 114 115 116 117 118 119 120
                            <input type="hidden" name="id" value= <%= boot.getId() %> >
                            <input type="submit" value="Borrar" > </input>
                        </form>
                    </th>
                    </tr>
                    <% } %>
              </tbody>
            </table>
121
                    </form>
122
        </div>
123

124 125 126 127 128 129 130 131 132


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

                             ProfesorDao profeDao2 = new ProfesorDao();
Angel Zarate committed
133
                             List<Profesor> listProfesor2 = profeDao2.listarProfesor();
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182
                             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>
183
    </html>