formulario_profesor.jsp 4.03 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <!DOCTYPE html>
    <html>

    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link href="css/bootstrap.css" rel="stylesheet" type="text/css" />
        <title>JSP Page</title>
    </head>

    <body>
        <div>
            <h1>Crear Profesor</h1>

            <%@ page import="com.roshka.proyectofinal.entity.Profesor, com.roshka.proyectofinal.profesor.ProfesorDao, java.util.List,java.util.Iterator" %>

        </div>

        <div>
            <%
                ProfesorDao profeDao = new ProfesorDao();
                List<Profesor> listProfe = profeDao.listar();
                Iterator<Profesor> iterProfe =  listProfe.iterator();
                Profesor profesor = null;
            %>

            <form method="post" action="SaveServletProfesor">
                <label for="nombre">
                    Nombre:
                </label>
                <input name="nombre"></input>

                <label for="apellido">
                    Apellido:
                </label>
                <input name="apellido"></input>

                <label for="correo">
                    Correo:
                </label>
                <input name="correo"></input>

                <label for="nro_cedula">
                    Numero de Cedula:
                </label>
                <input name="nro_cedula"></input>

                <button type="submit">
                    Crear Profesor
                </button>
            </form>

            <table>
              <thead>
                <tr>
                  <th>Nombre</th>
                  <th>Apellido</th>
                  <th>Numero de Cedula</th>
                  <th>Correo</th>
                  <th>Editar</th>
                  <th>Eliminar</th>
                </tr>
              </thead>
              <tbody>
                <% while(iterProfe.hasNext()){
                    profesor = iterProfe.next();

                %>
                    <th> <%= profesor.getNombre() %> </th>
                    <th> <%= profesor.getApellido() %> </th>
                    <th> <%= profesor.getNro_cedula() %> </th>
                    <th> <%= profesor.getCorreo() %> </th>

75
                    <th>  <form action="EditServletProfesor" method="get">
76
                            <input type="hidden" name="id" value=<%= profesor.getId() %>>
77
                            <input type="submit" value="Editar"> </input>
78 79 80 81 82 83 84 85 86 87 88 89 90 91
                          </form>
                    </th>
                    <th>
                        <form action="DeleteServletProfesor" method="get">
                            <input type="hidden" name="id" value= <%= profesor.getId() %> >
                            <input type="submit" value="Borrar" ></input>
                        </form>
                    </th>
                    </tr>
                    <% } %>
              </tbody>
            </table>
                    </form>
        </div>
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110

        <%
            Profesor profesorToEdit = (Profesor)request.getAttribute("Profesor");
            if(profesorToEdit != null){
        %>
        <form method="post" action="EditServletProfesor">
            <input type="hidden" value="<%= profesorToEdit.getId() %>" name="id" id="id" />
            <label for="nombre">Nombre:</label>
            <input type="text" name="nombre" value="<%= profesorToEdit.getNombre() %>" />
            <label for="apellido">Apellido:</label>
            <input type="text" name="apellido" value="<%= profesorToEdit.getApellido() %>"></input>
            <label for="correo">Correo:</label>
            <input type="text" name="correo" value="<%= profesorToEdit.getCorreo() %>"></input>
            <label for="nro_cedula">Numero de Cedula:</label>
            <input type="number" name="nro_cedula" value="<%= profesorToEdit.getNro_cedula() %>"></input>
            <button type="submit">Editar Profesor </button>
        </form>
        <% } %>

111 112 113
    </body>

    </html>