Commit c9f894c4 by Jose Baez

Merge branch 'develop' into 'master'

Develop

See merge request !27
parents 0bddeb3c 6f8c22e7
......@@ -37,6 +37,11 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>jakarta.servlet.jsp.jstl</artifactId>
<version>2.0.0-M1</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.3.5</version>
......
package com.roshka.proyectofinal;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpSession;
import java.io.*;
public class LoginHandler extends HttpServlet {
public void doPost(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
res.setContentType("text/html");
PrintWriter out = res.getWriter();
// Get the user's name and password
String name = req.getParameter("name");
String passwd = req.getParameter("passwd");
// Check the name and password for validity
if (!allowUser(name, passwd)) {
out.println("&lt;HTML&gt;&lt;HEAD&gt;&lt;TITLE&gt;Access Denied&lt;/TITLE&gt;&lt;/HEAD&gt;");
out.println("&lt;BODY&gt;Your login and password are invalid.&lt;BR&gt;");
out.println("You may want to &lt;A HREF=\"/login.html\"&gt;try again&lt;/A&gt;");
out.println("&lt;/BODY&gt;&lt;/HTML&gt;");
}
else {
// Valid login. Make a note in the session object.
HttpSession session = req.getSession(true);
session.putValue("logon.isDone", name); // just a marker object
// Try redirecting the client to the page he first tried to access
try {
String target = (String) session.getValue("login.target");
if (target != null)
res.sendRedirect(target);
return;
}
catch (Exception ignored) { }
// Couldn't redirect to the target. Redirect to the site's home page.
res.sendRedirect(req.getScheme() + "://" +
req.getServerName() + ":" + req.getServerPort());
}
}
protected boolean allowUser(String user, String passwd) {
return true; // trust everyone
}
}
\ No newline at end of file
package com.roshka.proyectofinal.Postulante;
import com.roshka.proyectofinal.entity.Postulante;
import jakarta.servlet.RequestDispatcher;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import static com.roshka.proyectofinal.Postulante.PostulanteDao.*;
@WebServlet("/filtros-postulante")
public class Filtros extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
List<Postulante> postulantes = listarPostulante();
String respuesta = req.getParameter("id");
boolean valor = Boolean.parseBoolean(req.getParameter("valor"));
String nombre = req.getParameter("nombreBuscar")== null ? "0" : req.getParameter("nombreBuscar");
System.out.println(nombre);
if(respuesta != null) {
update(Integer.parseInt(req.getParameter("id")), valor);
postulantes = listarPostulante();
} else if(nombre.length() > 1){
postulantes = buscarPorNombre(nombre);
}
req.getServletContext().setAttribute("postulantes", postulantes);
RequestDispatcher reqDisp= req.getRequestDispatcher("postulante-consulta.jsp");
reqDisp.forward(req,resp);
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
String respuesta = req.getParameter("nombre");
if(respuesta.equals("aceptado")){
List<Postulante> postulantes = listarPostulanteAceptados();
req.getServletContext().setAttribute("postulantes", postulantes);
RequestDispatcher reqDisp= req.getRequestDispatcher("postulante-consulta.jsp");
reqDisp.forward(req,resp);
} else if (respuesta.equals("notebook")) {
List<Postulante> postulantes = buscarPorNoteBook();
req.getServletContext().setAttribute("postulantes", postulantes);
RequestDispatcher reqDisp= req.getRequestDispatcher("postulante-consulta.jsp");
reqDisp.forward(req,resp);
} else {
List<Postulante> postulantes = listarPorBootcamp(respuesta);
req.getServletContext().setAttribute("postulantes", postulantes);
RequestDispatcher reqDisp= req.getRequestDispatcher("postulante-consulta.jsp");
reqDisp.forward(req,resp);
}
}
}
......@@ -80,13 +80,27 @@ public class SaveServlet extends HttpServlet {
}
int status=PostulanteDao.save(postulante);
if(status>0){
out.print("<p>Record saved successfully!</p>");
request.getRequestDispatcher("index.html").include(request, response);
//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);
}else{
if (rechazarDatos){
out.println("El correo ingresado ya esta registrado para el bootcamp actual");
//out.println("El correo ingresado ya esta registrado para el bootcamp actual");
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);
}else {
out.println("Sorry! unable to save record");
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" +
"</div>");
request.getRequestDispatcher("formulario.jsp").include(request, response);
}
}
......
......@@ -3,9 +3,9 @@ package com.roshka.proyectofinal.bootcamp;
import com.roshka.proyectofinal.DataBase;
import com.roshka.proyectofinal.entity.Bootcamp;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.*;
import java.util.ArrayList;
import java.util.List;
public class BootcampDao {
......@@ -33,4 +33,107 @@ public class BootcampDao {
return status;
}
public static int update(Bootcamp b){
int status=0;
try{
Connection con= DataBase.getConnection();
PreparedStatement ps=con.prepareStatement(
"update Bootcamp set id_lenguaje=?,id_profesor=?,fecha_inicio=?,fecha_fin=?,descripcion=?,titulo=?,activo=? where id=?");
ps.setInt(1,b.getId_lenguaje());
ps.setInt(2,b.getId_profesor());
ps.setString(3,b.getFecha_inicio());
ps.setString(4,b.getFecha_fin());
ps.setString(5,b.getDescripcion());
ps.setString(6,b.getTitulo());
ps.setBoolean(7,b.getActivo());
ps.setInt(8,b.getId());
status=ps.executeUpdate();
con.close();
}catch(Exception ex){ex.printStackTrace();}
return status;
}
public static List<Bootcamp> listar(){
ArrayList<Bootcamp> list = new ArrayList<>();
String sql = "select a.id, a.fecha_inicio, a.fecha_fin, a.descripcion, a.titulo,\n" +
"a.activo, b.nombre_lenguaje, c.nombre, c.apellido \n" +
"from bootcamp a\n" +
"inner join lenguaje b\n" +
"on a.id_lenguaje=b.id\n" +
"inner join profesor c\n" +
"on a.id_profesor=c.id";
try{
Connection con= DataBase.getConnection();
PreparedStatement ps=con.prepareStatement(sql);
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;
}
public static int delete(int id){
int status=0;
try{
Connection con=DataBase.getConnection();
PreparedStatement ps=con.prepareStatement("delete from bootcamp where id=?");
ps.setInt(1,id);
status=ps.executeUpdate();
con.close();
}catch(Exception e){e.printStackTrace();}
return status;
}
public static Bootcamp getBootcampById(int id){
Bootcamp b=new Bootcamp();
try{
Connection con=DataBase.getConnection();
PreparedStatement ps=con.prepareStatement("select * from bootcamp where id=?");
ps.setInt(1,id);
ResultSet rs=ps.executeQuery();
if(rs.next()){
b.setId(rs.getInt("id"));
b.setActivo(rs.getBoolean("activo"));
b.setDescripcion(rs.getString("descripcion"));
b.setTitulo(rs.getString("titulo"));
b.setFecha_fin(rs.getString("fecha_fin"));
b.setFecha_inicio(rs.getString("fecha_inicio"));
b.setNombre_profesor(rs.getString("nombre"));
b.setApellido_profesor(rs.getString("apellido"));
b.setNombre_lenguaje(rs.getString("nombre_lenguaje"));
b.setImagen(rs.getString("imagen"));
}
con.close();
}catch(Exception ex){ex.printStackTrace();}
return b;
}
}
package com.roshka.proyectofinal.bootcamp;
import java.io.IOException;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
@WebServlet("/DeleteServletBootcamp")
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);
response.sendRedirect("formulario_bootcamp.jsp");
}
}
package com.roshka.proyectofinal.bootcamp;
import jakarta.servlet.RequestDispatcher;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.ServletException;
import java.io.IOException;
public class EditServlet extends HttpServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
String sid=request.getParameter("id");
int id=Integer.parseInt(sid);
request.setAttribute("id", id);
RequestDispatcher rd = request.getRequestDispatcher("formulario_bootcamp.jsp");
rd.forward(request, response);
}
}
\ No newline at end of file
......@@ -28,8 +28,6 @@ public class SaveServlet extends HttpServlet {
activo = true;
}
Bootcamp b =new Bootcamp( id_lenguaje, id_profesor, fecha_inicio, fecha_fin, descripcion, imagen, titulo, activo);
int status= BootcampDao.save(b);
......
......@@ -2,7 +2,7 @@ package com.roshka.proyectofinal.entity;
public class Bootcamp {
private int id, id_lenguaje, id_profesor;
private String fecha_inicio,fecha_fin,descripcion,imagen,titulo;
private String fecha_inicio,fecha_fin,descripcion,imagen,titulo, nombre_profesor, apellido_profesor, nombre_lenguaje;
private boolean activo;
public Bootcamp() {
......@@ -24,6 +24,10 @@ public class Bootcamp {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getId_lenguaje() {
return id_lenguaje;
}
......@@ -81,12 +85,35 @@ public class Bootcamp {
}
public boolean getActivo() {
return activo;
return this.activo;
}
public void setActivo(boolean activo) {
this.activo = activo;
public boolean setActivo(boolean activo) {
return this.activo = activo;
}
public String getNombre_profesor() {
return nombre_profesor;
}
public void setNombre_profesor(String nombre_profesor) {
this.nombre_profesor = nombre_profesor;
}
public String getApellido_profesor() {
return apellido_profesor;
}
public void setApellido_profesor(String apellido_profesor) {
this.apellido_profesor = apellido_profesor;
}
public String getNombre_lenguaje() {
return nombre_lenguaje;
}
public void setNombre_lenguaje(String nombre_lenguaje) {
this.nombre_lenguaje = nombre_lenguaje;
}
}
......@@ -3,6 +3,7 @@ package com.roshka.proyectofinal.entity;
public class LoginBean {
private String username;
private String password;
private String correo;
public String getUsername() {
return username;
......@@ -19,4 +20,12 @@ public class LoginBean {
public void setPassword(String password) {
this.password = password;
}
public void setCorreo(String correo) {
this.correo = correo;
}
public String getCorreo() {
return correo;
}
}
......@@ -5,6 +5,7 @@ package com.roshka.proyectofinal.entity;
public class Postulante {
private int id,nroCedula,bootcampId;
private String nombreBootcamp;
private String nombre,apellido,telefono,direccion,correo;
private boolean expLaboral,estudioUniversitario,notebook,aceptado;
......@@ -27,6 +28,22 @@ public class Postulante {
this.bootcampId = bootcampId;
this.aceptado = aceptado;
}
public Postulante(int nroCedula, String nombreBootcam, String nombre, String apellido, String telefono, String direccion, String correo, boolean expLaboral, boolean estudioUniversitario, boolean notebook, int bootcampId, boolean aceptado) {
this.nroCedula = nroCedula;
this.nombreBootcamp = nombreBootcam;
this.nombre = nombre;
this.apellido = apellido;
this.telefono = telefono;
this.direccion = direccion;
this.correo = correo;
this.expLaboral = expLaboral;
this.estudioUniversitario = estudioUniversitario;
this.notebook = notebook;
this.bootcampId = bootcampId;
this.aceptado = aceptado;
}
public int getId() {
return id;
}
......@@ -97,4 +114,39 @@ public class Postulante {
this.bootcampId = bootcampId;
}
public void setId(int id) {
this.id = id;
}
public int getNroCedula() {
return nroCedula;
}
public void setNroCedula(int nroCedula) {
this.nroCedula = nroCedula;
}
public String getNombreBootcamp() {
return nombreBootcamp;
}
public void setNombreBootcamp(String nombreBootcamp) {
this.nombreBootcamp = nombreBootcamp;
}
public boolean isExpLaboral() {
return expLaboral;
}
public boolean isEstudioUniversitario() {
return estudioUniversitario;
}
public boolean isNotebook() {
return notebook;
}
public boolean isAceptado() {
return aceptado;
}
}
......@@ -15,6 +15,14 @@ public class Profesor {
this.correo = correo;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getNombre() {
return nombre;
}
......
......@@ -4,6 +4,7 @@ public class Usuario {
private int id;
private String nombre,apellido,correo,contrasena;
public Usuario() {
}
......
package com.roshka.proyectofinal.lenguaje;
import com.roshka.proyectofinal.entity.Lenguaje;
import jakarta.servlet.RequestDispatcher;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
......@@ -9,16 +7,15 @@ import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
@WebServlet("/ProyectoFinal-Bootcamp/crearBootcamp")
public class ObtenerLenguaje extends HttpServlet {
@WebServlet("/DeleteServletLenguaje")
public class DeleteServlet extends HttpServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
List<Lenguaje> len = LenguajeDao.listar();
request.setAttribute("listaLenguaje", len);
RequestDispatcher rqd = request.getRequestDispatcher("./formulario_bootcamp.jsp");
rqd.forward(request, response);
String sid=request.getParameter("id");
int id=Integer.parseInt(sid);
System.out.println("Este es el id " + id);
LenguajeDao.delete(id);
response.sendRedirect("formulario_lenguaje.jsp");
}
}
package com.roshka.proyectofinal.lenguaje;
import com.roshka.proyectofinal.DataBase;
import com.roshka.proyectofinal.entity.Bootcamp;
import com.roshka.proyectofinal.entity.Lenguaje;
import jakarta.servlet.RequestDispatcher;
......@@ -19,6 +20,7 @@ public class LenguajeDao {
Connection con= DataBase.getConnection();
PreparedStatement ps=con.prepareStatement(
"insert into lenguaje (nombre_lenguaje) values (?)");
ps.setString(1,l.getNombre_lenguaje());
status=ps.executeUpdate();
......@@ -49,4 +51,37 @@ public class LenguajeDao {
}
return list;
}
public static int delete(int id){
int status=0;
try{
Connection con=DataBase.getConnection();
PreparedStatement ps=con.prepareStatement("delete from lenguaje where id=?");
ps.setInt(1,id);
status=ps.executeUpdate();
con.close();
}catch(Exception e){e.printStackTrace();}
return status;
}
public static Lenguaje getLenguajeById(int id){
Lenguaje lenguaje=new Lenguaje();
try{
Connection con=DataBase.getConnection();
PreparedStatement ps=con.prepareStatement("select * from lenguaje where id=?");
ps.setInt(1,id);
ResultSet rs=ps.executeQuery();
if(rs.next()){
lenguaje.setId(rs.getInt("id"));
lenguaje.setNombre_lenguaje(rs.getString("nombre_lenguaje"));
}
con.close();
}catch(Exception ex){ex.printStackTrace();}
return lenguaje;
}
}
......@@ -2,6 +2,7 @@ package com.roshka.proyectofinal.lenguaje;
import com.roshka.proyectofinal.entity.Lenguaje;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
......@@ -9,6 +10,7 @@ import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
@WebServlet("/SaveServletLenguaje")
public class SaveServlet extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response)
......@@ -23,7 +25,7 @@ public class SaveServlet extends HttpServlet {
int status=LenguajeDao.save(l);
if(status>0){
out.print("<p>Record saved successfully!</p>");
request.getRequestDispatcher("index.html").include(request, response);
request.getRequestDispatcher("formulario_lenguaje.jsp").include(request, response);
}else{
out.println("Sorry! unable to save record");
}
......
......@@ -6,27 +6,27 @@ import com.roshka.proyectofinal.entity.LoginBean;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
public class LoginDao {
public boolean validate (LoginBean loginBean) {
int status = 0;
boolean status = false;
try {
Connection con = DataBase.getConnection();
PreparedStatement ps=con.prepareStatement(
"select * from usuarios where username=? and password = ?");
ps.setString(1,loginBean.getUsername());
"select * from usuario where correo=? and contrasena = ?");
ps.setString(1,loginBean.getCorreo());
ps.setString(2, loginBean.getPassword());
status=ps.executeUpdate();
ResultSet rs = ps.executeQuery();
status = rs.next();
con.close();
} catch (Exception ex) {
ex.printStackTrace();
}
if (status > 0) return true ;
else return false ;
return status ;
}
......
package com.roshka.proyectofinal.login;
import java.io.IOException;
import java.io.PrintWriter;
import java.security.NoSuchAlgorithmException;
import jakarta.servlet.RequestDispatcher;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import com.roshka.proyectofinal.entity.LoginBean;
import com.roshka.proyectofinal.login.md5JavaHash;
import jakarta.servlet.http.HttpSession;
import static java.lang.System.out;
/**
* Servlet implementation class LoginServlet
......@@ -16,7 +19,6 @@ import com.roshka.proyectofinal.entity.LoginBean;
@WebServlet("/login")
public class LoginServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
......@@ -38,24 +40,60 @@ public class LoginServlet extends HttpServlet {
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
LoginDao loginDao = new LoginDao();
md5JavaHash passEncrip = new md5JavaHash();
String passwordMD5 = "";
response.setContentType("text/html");
PrintWriter out = response.getWriter();
String username = request.getParameter("username");
String correo = request.getParameter("correo");
String password = request.getParameter("password");
LoginBean loginBean = new LoginBean();
loginBean.setUsername(username);
loginBean.setPassword(password);
try {
passwordMD5 = passEncrip.getHashPass(password);
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
loginBean.setPassword(passwordMD5);
loginBean.setCorreo(correo);
//out.println("EL pass encriptado es: " +passwordMD5);
if (loginDao.validate(loginBean))
{
response.sendRedirect("loginSuccess.jsp");
HttpSession session = request.getSession(true); //incluir nota de sesion valida
session.setAttribute("logon.isDone", correo);
//out.print ("Bienvenido " + correo);
// Tratar de re-dirigir a la pagina que el usuario quiso acceder
try {
String target = (String) session.getAttribute("login.target");
//response.sendRedirect("loginSuccess.jsp");
//out.println(" \n Destino: " + target);
if (target != null)
response.sendRedirect(target);
//return;
}
catch (Exception ignored) { }
// Si no es posible redireccionar a la pagina solicitada, llevar a la main page
RequestDispatcher rd = request.getRequestDispatcher("menu.html");
rd.include(request,response);
} else {
//si no es un user valido - mandar error y redireccionar al inicio de sesion
RequestDispatcher rd = request.getRequestDispatcher("/login.jsp");
//out.print("<div br align = \"center\" class=\"messageError\" > Credenciales incorrectas! Reintente ... </div>");
rd.include(request,response);
}
}
else {
//HttpSession session = request.getSession();
response.sendRedirect("login.jsp");
}
}
}
\ No newline at end of file
}
package com.roshka.proyectofinal.login;
import java.io.IOException;
import java.io.PrintWriter;
import jakarta.servlet.RequestDispatcher;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpSession;
/**
* Servlet implementation class LoginServlet
*/
@WebServlet("/logout")
public class LogoutServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public LogoutServlet() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
//response.getWriter().append("Served at: ").append(request.getContextPath());
response.setContentType("text/html");
PrintWriter out = response.getWriter();
//out.print("Has cerrado tu sesion !");
request.getRequestDispatcher("index.html").include(request,response);
HttpSession session = request.getSession(true);
session.invalidate();
out.close();
}
}
\ No newline at end of file
package com.roshka.proyectofinal;
package com.roshka.proyectofinal.login;
import java.io.*;
import java.util.*;
import jakarta.servlet.*;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.*;
@WebServlet("/protected")
public class ProtectedResource extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
......@@ -15,16 +18,22 @@ public class ProtectedResource extends HttpServlet {
HttpSession session = req.getSession(true);
// Does the session indicate this user already logged in?
Object done = session.getValue("logon.isDone");
Object done = session.getAttribute("logon.isDone");
// marker object
if (done == null) {
// No logon.isDone means he hasn't logged in. // Save the request URL as the true target and redirect to the login page
session.putValue("login.target",
HttpUtils.getRequestURL(req).toString()); res.sendRedirect(req.getScheme() + "://" + req.getServerName() + ":"
+ req.getServerPort() + "/login.html");
// No se encuentra loggeado // Guardamos donde trato de dirigirse y lo REDIRIGIMOS AL LOGGIN
session.setAttribute("login.target",
HttpUtils.getRequestURL(req).toString());
res.sendRedirect(req.getScheme() + "://" + req.getServerName() + ":"
+ req.getServerPort() + "/finalProyect2/login.jsp");
return;
}
// If we get here, the user has logged in and can see the goods
out.println("Unpublished O'Reilly book manuscripts await you!");
// El usuario se loggeo y puede ver el recurso
out.println("PUEDES ACCEDER AL RECURSO - ESTAS LOGGEADO");
}
}
\ No newline at end of file
package com.roshka.proyectofinal.login;
import java.security.*;
public class md5JavaHash {
private String hashpass="";
public String getHashPass(String password) throws
NoSuchAlgorithmException{
String plainText = password;
MessageDigest mdAlgorithm = MessageDigest.getInstance("MD5");
mdAlgorithm.update(plainText.getBytes());
byte[] digest = mdAlgorithm.digest();
StringBuffer hexString = new StringBuffer();
for (int i = 0; i < digest.length; i++) {
plainText = Integer.toHexString(0xFF & digest[i]);
if (plainText.length() < 2) {
plainText = "0" + plainText;
}
hexString.append(plainText);
}
hashpass = hexString.toString();
return hashpass;
}
}
package com.roshka.proyectofinal.profesor;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebServlet("/DeleteServletProfesor")
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);
ProfesorDao.delete(id);
response.sendRedirect("formulario_profesor.jsp");
}
}
......@@ -5,6 +5,10 @@ import com.roshka.proyectofinal.entity.Profesor;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
public class ProfesorDao {
......@@ -26,4 +30,67 @@ public class ProfesorDao {
return status;
}
public static List<Profesor> listar(){
ArrayList<Profesor> list = new ArrayList<>();
String sql = "select * from profesor";
try{
Connection con= DataBase.getConnection();
PreparedStatement ps=con.prepareStatement(sql);
ResultSet rs = ps.executeQuery();
while(rs.next()){
Profesor profe = new Profesor();
profe.setId(rs.getInt("id"));
profe.setNombre(rs.getString("nombre"));
profe.setApellido(rs.getString("apellido"));
profe.setNro_cedula(rs.getInt("nro_cedula"));
profe.setCorreo(rs.getString("correo"));
list.add(profe);
}
con.close();
} catch (SQLException e) {
throw new RuntimeException(e);
}
return list;
}
public static int delete(int id){
int status=0;
try{
Connection con=DataBase.getConnection();
PreparedStatement ps=con.prepareStatement("delete from profesor where id=?");
ps.setInt(1,id);
status=ps.executeUpdate();
con.close();
}catch(Exception e){e.printStackTrace();}
return status;
}
public static Profesor getProfesorById(int id){
Profesor p=new Profesor();
try{
Connection con=DataBase.getConnection();
PreparedStatement ps=con.prepareStatement("select * from profesor where id=?");
ps.setInt(1,id);
ResultSet rs=ps.executeQuery();
if(rs.next()){
p.setId(rs.getInt("id"));
p.setNombre(rs.getString("nombre"));
p.setApellido(rs.getString("apellido"));
p.setNro_cedula(rs.getInt("nro_cedula"));
p.setCorreo(rs.getString("correo"));
}
con.close();
}catch(Exception ex){ex.printStackTrace();}
return p;
}
}
......@@ -2,6 +2,7 @@ package com.roshka.proyectofinal.profesor;
import com.roshka.proyectofinal.entity.Profesor;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
......@@ -9,6 +10,7 @@ import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
@WebServlet("/SaveServletProfesor")
public class SaveServlet extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
......@@ -25,7 +27,7 @@ public class SaveServlet extends HttpServlet {
int status=ProfesorDao.save(p);
if(status>0){
out.print("<p>Record saved successfully!</p>");
request.getRequestDispatcher("index.html").include(request, response);
request.getRequestDispatcher("formulario_profesor.jsp").include(request, response);
}else{
out.println("Sorry! unable to save record");
}
......
package com.roshka.proyectofinal.usuario;
import com.roshka.proyectofinal.entity.Usuario;
import com.roshka.proyectofinal.profesor.ProfesorDao;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
public class SaveServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out=response.getWriter();
String nombre=request.getParameter("nombre");
String apellido=request.getParameter("apellido");
String email=request.getParameter("correo");
String contrasena=request.getParameter("contrasena");
Usuario u =new Usuario(nombre, apellido, email, contrasena);
int status= UsuarioDao.save(u);
if(status>0){
out.print("<p>Record saved successfully!</p>");
request.getRequestDispatcher("index.html").include(request, response);
}else{
out.println("Sorry! unable to save record");
}
out.close();
}
}
package com.roshka.proyectofinal.usuario;
import com.roshka.proyectofinal.DataBase;
import com.roshka.proyectofinal.entity.Usuario;
import java.sql.Connection;
import java.sql.PreparedStatement;
public class UsuarioDao {
public static int save(Usuario u){
int status=0;
try{
Connection con= DataBase.getConnection();
PreparedStatement ps=con.prepareStatement(
"insert into usuario (nombre,apellido,contrasena,correo) values (?,?,?,?)");
ps.setString(1,u.getNombre());
ps.setString(2,u.getApellido());
ps.setString(3,u.getContrasena());
ps.setString(4,u.getCorreo());
status=ps.executeUpdate();
con.close();
}catch(Exception ex){ex.printStackTrace();}
return status;
}
}
/* el header donde va el logo y el menu */
html,body{
background-image: url(imagenes/descarga.svg);
}
/* damos los estilos a todo lo que contiene el body */
body{
background-color: rgba(11, 49, 110, 0.75);
font-family:Calibri, Candara, Segoe, Segoe UI, Optima, Arial, sans-serif;
color: wheat;
font-weight: bold;
display: flex;
justify-content: center;
align-items: center;
height: 160%;}
}
/* para el logo */
img{
width: 165px;
padding: 10px;
}
p.enter{
text-align: center;
font-size: 20px;
}
/* para el parrafo */
p:hover{
color: yellow;
}
/* para el create o sea para el main */
.create{
width: 100%;
max-width: 785px;
min-width: 320px;
border-radius: 15px;
background-color: rgba(11, 49, 110, 0.75);
padding: 1rem;
}
/* contenedor */
/* para el forrmulario */
.form label{
display: block;
border: none;
align-items:center;
}
.form input{
display: block;
border: none;
width: 50%;
align-items:center;
}
.form input[type="email"],.form input[type="text"],.form input[type="number"]{
background-color: transparent;
border-radius: 10px;
border: 1px solid #000;
}
.form input:hover{
background-color: wheat;
}
a{
text-decoration: none;
}
ul{
list-style:none;
font-size:15px;
}
a{
text-decoration:none;
color:black;
background-color: #21211d;
border-radius: 10px;
color: #FFF;
padding: 10px;
margin:15px;
text-decoration: none;
cursor: pointer;
background-image: url(imagenes/descarga.svg);
}
.form input[type="reset"] , .form input[type="submit"]{
text-decoration:none;
background-color: rgba(11, 49, 110, 0.75);
background-image: url(imagenes/descarga.svg);
border-radius: 10px;;
padding: 15px;
border-radius: 10px;
text-decoration: none;
color:#ffff;
text-align:left;
cursor: pointer;
width:80px;
text-align:center;
}
input#ruby,input#python,input#c,input#javascript,input#java{
width:20px;
}
input#experiencia_laboral,input#notebook,input#universidad{
width:100px;
}
/* parrafo final */
//mi parte jose leeme
</style>
* {
box-sizing: border-box;
}
body {
font-family: 'Concert One', cursive;
font-size: 13px
}
.header, .footer {
background-color:rgb(18, 18, 98);
color: white;
padding: 60px;
}
.column {
float: left;
padding: 30px;
}
.clearfix::after {
content: "";
clear: both;
display: table;
}
a{
color:white;
}
.menu {
width: 50%;
}
.content {
width: 50%;
}
.menu ul {
list-style-type: none;
margin: 0;
padding: 0;
}
.menu li {
padding: 8px;
margin-bottom: 8px;
background-color: rgb(18, 18, 98);
color: #ffffff;
}
.menu li:hover {
background-color: rgb(18, 18, 98);
}
\ No newline at end of file
<!-- <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta id="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<title>postulacion</title>
</head> -->
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
......@@ -15,19 +6,28 @@ pageEncoding="UTF-8"%>
<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>
<link href="estilos/form.css" rel="stylesheet" type="text/css" />
<link rel="shortcut icon" href="imagenes/roshkaicon.ico" sizes="any" />
<!-- CSS only -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-0evHe/X+R7YkIZDRvuzKMRqM+OrBnVFBL6DOitfPri4tjfHxaWutUpFmBp4vmVor" crossorigin="anonymous">
<link rel="stylesheet" media="(max-width: 800px)" href="example.css" />
<title>Formulario Postulante</title>
</head>
<body>
<main>
<header>
<div class="logo">
<img src="imagenes/logo-roshka.svg" alt="log-roshka" />
</div>
</header>
<main class="create">
<article class="contenedor">
<div>
<p>Si sigues interesado y cumples con los requisitos, completa el siguiente formulario: </p>
<p class="enter">Si sigues interesado y cumples con los requisitos, completa el siguiente formulario: </p>
<form method="post" action="SaveServlet">
<form method="post" action="SaveServlet" class="form">
<label for="nombre">Ingrese su Nombre:</label>
<label class="mr-2" for="nombre">Ingrese su Nombre:</label>
<input required id="nombre" name="nombre" type="text"><br>
<label for="apellido">Ingrese su Apellido:</label>
......@@ -45,10 +45,6 @@ pageEncoding="UTF-8"%>
<label for="direccion">Direccion:</label>
<input required id="direccion" name="direccion" type="text"><br>
<label for="experiencia_laboral">Experiencia laboral</label>
<!-- Si no lo marca el valor que envia es null y si lo marca es "ON" -->
<input id="experiencia_laboral" name="experiencia_laboral" type="checkbox"><br>
<p for="experiencia_programando">Lenguajes de programacion que conoces:</p>
<%@ page import="com.roshka.proyectofinal.entity.Lenguaje, com.roshka.proyectofinal.lenguaje.LenguajeDao, java.util.List,java.util.Iterator" %>
......@@ -65,8 +61,8 @@ pageEncoding="UTF-8"%>
len = iter.next();
%>
<li>
<label for=<%=len.getNombre_lenguaje() %> > <%= len.getNombre_lenguaje() %> </label><input value=<%=len.getId() %> id=
<li class="d-flex check-inline" >
<label for=<%=len.getNombre_lenguaje() %> > <%= len.getNombre_lenguaje() %> </label><input value=<%=len.getId() %> id=
<%=len.getNombre_lenguaje() %> name=
<%=len.getNombre_lenguaje() %> type="checkbox"><br>
</li>
......@@ -74,19 +70,189 @@ pageEncoding="UTF-8"%>
<% } %>
</ul>
<li class="d-flex">
<label for="experiencia_laboral" >Experiencia laboral</label>
</li>
<!-- Si no lo marca el valor que envia es null y si lo marca es "ON" -->
<input id="experiencia_laboral" name="experiencia_laboral" type="checkbox" ><br>
<p for="experiencia_programando">Lenguajes de programacion que conoces:</p>
<label for="notebook">Cuenta con notebook:</label>
<input id="notebook" name="notebook" type="checkbox"><br>
<label for="notebook">Cuenta con notebook</label>
<input id="notebook" name="notebook" type="checkbox"><br>
<label for="universidad">Estudio Universitario: </label>
<label for="universidad">Estudio Universitario </label>
<input id="universidad" name="universidad" type="checkbox"><br>
<input type="submit">
<input type="reset" value="Borrar">
<input class="enviar info error" type="submit">
<input class="borrar" type="reset" value="Borrar"><br>
<label for="otro">otro</label>
<input id="otro" name="otro" type="checkbox"><br>
<a href="index.html">volver</a>
</form>
</div>
</article>
</main>
</body>
</html>
<style>
/* el header donde va el logo y el menu */
html,body{
background-image: url(imagenes/descarga.svg);
}
/* damos los estilos a todo lo que contiene el body */
body{
background-color: rgba(11, 49, 110, 0.75);
font-family:Calibri, Candara, Segoe, Segoe UI, Optima, Arial, sans-serif;
color: wheat;
font-weight: bold;
display: flex;
justify-content: center;
align-items: center;
height: 160%;}
}
/* para el logo */
img{
width: 165px;
padding: 10px;
}
p.enter{
text-align: center;
font-size: 20px;
}
/* para el parrafo */
p:hover{
color: yellow;
}
/* para el create o sea para el main */
.create{
width: 100%;
max-width: 785px;
min-width: 320px;
border-radius: 15px;
background-color: rgba(11, 49, 110, 0.75);
padding: 1rem;
}
/* contenedor */
/* para el forrmulario */
.form label{
display: block;
border: none;
align-items:center;
}
.form input{
display: block;
border: none;
width: 50%;
align-items:center;
}
.form input[type="email"],.form input[type="text"],.form input[type="number"]{
background-color: transparent;
border-radius: 10px;
border: 1px solid #000;
}
.form input:hover{
background-color: wheat;
}
a{
text-decoration: none;
}
ul{
list-style:none;
font-size:15px;
}
a{
text-decoration:none;
color:black;
background-color: #21211d;
border-radius: 10px;
color: #FFF;
padding: 10px;
margin:15px;
text-decoration: none;
cursor: pointer;
background-image: url(imagenes/descarga.svg);
}
.form input[type="reset"] , .form input[type="submit"]{
text-decoration:none;
background-color: rgba(11, 49, 110, 0.75);
background-image: url(imagenes/descarga.svg);
border-radius: 5px;;
padding: 10px;
border-radius: 10px;
margin:10px;
text-decoration: none;
color:#ffff;
text-align:left;
cursor: pointer;
width:80px;
text-align:center;
}
/*hola mundo*/
input#ruby,input#python,input#c,input#javascript,input#java{
width:30px;
}
input#experiencia_laboral,input#notebook,input#universidad{
width:500px;
}
/* para el alert */
.alert {
padding: 10px;
background-color: background-color: #2196F3;
color: white;
}
.alert.info {background-color: #2196F3;}
.alert.error {background-color: #ff0000;}
.closebtn {
margin-left: 15px;
color: white;
font-weight: bold;
float: right;
font-size: 22px;
line-height: 20px;
cursor: pointer;
transition: 0.3s;
}
.closebtn:hover {
color: black;
}
</style>
<script>
var close = document.getElementsByClassName("enviar");
var i;
</html>
\ No newline at end of file
for (i = 0; i < close.length; i++) {
close[i].onclick = function(){
var div = this.parentElement;
div.style.opacity = "0";
setTimeout(function(){ div.style.display = "none"; }, 600);
}
}
</script>
\ No newline at end of file
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
......@@ -13,13 +13,18 @@ pageEncoding="UTF-8"%>
<div class="container">
<h1>Crear Bootcamp</h1>
<%@ page import="com.roshka.proyectofinal.entity.Lenguaje, com.roshka.proyectofinal.lenguaje.LenguajeDao, java.util.List,java.util.Iterator" %>
<%@ 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" %>
<%
LenguajeDao lenDao = new LenguajeDao();
List<Lenguaje> listLenguaje = lenDao.listar();
Iterator<Lenguaje> iter = listLenguaje.iterator();
Lenguaje len = null;
Lenguaje len = null;
ProfesorDao profeDao = new ProfesorDao();
List<Profesor> listProfesor = profeDao.listar();
Iterator<Profesor> iterProfe = listProfesor.iterator();
Profesor profe = null;
%>
<form action="" method="post">
<label for="lenguaje">Lenguajes:</label>
......@@ -33,6 +38,70 @@ pageEncoding="UTF-8"%>
</option>
<% } %>
</select>
<label for="lenguaje">Profesores:</label>
<select name="lenguaje" id="lenguaje">
<% while(iterProfe.hasNext()){
profe = iterProfe.next();
%>
<option value=<%= profe.getId() %> >
<%= profe.getNombre() + " " + profe.getApellido() %>
</option>
<% } %>
</select>
</form>
</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>
<th> <form action="/bootcamp/EditServlet">
<input type="hidden" name="id" value=<%= boot.getId() %>>
<input type="submit" value="Editar" > </input>
</form>
</th>
<th>
<form action="DeleteServletBootcamp" method="get">
<input type="hidden" name="id" value= <%= boot.getId() %> >
<input type="submit" value="Borrar" > </input>
</form>
</th>
</tr>
<% } %>
</tbody>
</table>
</form>
</div>
</body>
......
<%@ 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 Lenguaje</h1>
<%@ page import="com.roshka.proyectofinal.entity.Lenguaje, com.roshka.proyectofinal.lenguaje.LenguajeDao, java.util.List,java.util.Iterator" %>
</div>
<div>
<%
LenguajeDao lenDao = new LenguajeDao();
List<Lenguaje> listLen = lenDao.listar();
Iterator<Lenguaje> iterLen = listLen.iterator();
Lenguaje lenguaje = null;
%>
<form method="post" action="SaveServletLenguaje">
<label for="nombre_lenguaje">
Nombre del Lenguaje nuevo:
</label>
<input name="nombre_lenguaje">
</input>
<button type="submit">
Crear Lenguaje
</button>
</form>
<table>
<thead>
<tr>
<th>Lenguaje</th>
<th>Editar</th>
<th>Eliminar</th>
</tr>
</thead>
<tbody>
<% while(iterLen.hasNext()){
lenguaje = iterLen.next();
%>
<th> <%= lenguaje.getNombre_lenguaje() %> </th>
<th> <form action="EditServlet" method="get">
<input type="hidden" name="id" value=<%= lenguaje.getId() %>>
<input type="submit" value="Editar" > </input>
</form>
</th>
<th>
<form action="DeleteServletLenguaje" method="get">
<input type="hidden" name="id" value= <%= lenguaje.getId() %> >
<input type="submit" value="Borrar" > </input>
</form>
</th>
</tr>
<% } %>
</tbody>
</table>
</form>
</div>
</body>
</html>
\ No newline at end of file
<%@ 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>
<th> <form action="EditServlet" method="get">
<input type="hidden" name="id" value=<%= profesor.getId() %>>
<input type="submit" value="Editar" > </input>
</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>
</body>
</html>
\ No newline at end of file
......@@ -16,18 +16,27 @@
<title>Roshka WebSite</title>
</head>
<div class="header">
<div class="logo">
<a href="./index.html"> <img class="logoi" src="imagenes/logo-roshka.svg" alt="" /> </a>
<!-- logo con link -->
</div>
<div class="menu">
<ul>
<li class="link-menu"><a href="">Home</a></li>
<li class="link-menu"><a href="formulario.jsp">Postulate</a></li>
<li class="link-menu"><a href="formulario_bootcamp.jsp">Crear bootcamp</a>
<li class="link-menu"><a href="login.jsp">Login</a>
<li class="link-menu"><a href="protected">Recurso Protegido</a></li>
</li>
<li class="link-menu"><a href="formulario_lenguaje.jsp">Crear lenguaje</a>
</li>
<li class="link-menu"><a href="formulario_profesor.jsp">Crear profesor</a>
</li>
</ul>
</div>
<!-- menu -->
</div>
......@@ -54,7 +63,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">
<button type="submit" class="cta-main">POSTULACION</button>
<a href="formulario.jsp"><button type="submit" class="cta-main">POSTULACION</button></a>
<!-- <a href="/postulacion" class="cta-main">POSTULACION</a> -->
</div>
</div>
......
......@@ -14,6 +14,10 @@
</h1>
<br/>
<a href="hello-servlet">Hello Servlet</a><br>
<a href="login.jsp">LOGIN</a><br>
<a href="logout">LOGOUT</a><br>
<a href="protected">RECUSO PROTEGIDO</a><br>
</body>
......
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html>
<head>
<title>BootcampsLogin</title>
</head>
<body>
<div align=" center">
<h1>User Login Form</h1>
<form action="login" method="post">
<table>
<tr><td>User Name:</td> <td><input type="text" name = "username"></td></tr>
<tr><td>Password:</td><td><input type="password" name="password"></td></tr>
<tr><td><input type="submit" value="Login"/></td></tr>
<!--
Follow me on
------------
Codepen: https://codepen.io/mycnlz/
Dribbble: https://dribbble.com/mycnlz
Pinterest: https://pinterest.com/mycnlz/
-->
</table>
</form>
<div class='box'>
<div class='box-form'>
<div class='box-login-tab'></div>
<div class='box-login-title'>
<div class='i i-login'></div><h2> USUARIO </h2>
<link rel="stylesheet" href="usrebe.css">
<link rel="stylesheet" href="usrebe.js">
</div>
<form action="login" method="post">
<div class='box-login'>
<div class='fieldset-body' id='login_form'>
<button onclick="openLoginInfo();" class='b b-form i i-more' title='Mais Informações'></button>
<p class='field'>
<label for='user'>E-MAIL</label>
<input type='text' id='correo' name='correo' title='Correo' />
<span id='valida' class='i i-warning'></span>
</p>
<p class='field'>
<label for='password'>PASSWORD</label>
<input type='password' id='password' name='password' title='Password' />
<span id='valida' class='i i-close'></span>
</p>
</body>
</html>
\ No newline at end of file
<input type='submit' id='do_login' value='INICIAR SESION' title='INICIAR SESION' />
</div>
</div>
</div>
</form>
<div class='box-info'>
<p><button onclick="closeLoginInfo();" class='b b-info i i-left' title='Back to Sign In'></button><h3>Need Help?</h3>
</p>
<div class='line-wh'></div>
<button onclick="" class='b-support' title='Forgot Password?'> Forgot Password?</button>
<button onclick="" class='b-support' title='Contact Support'> Contact Support</button>
<div class='line-wh'></div>
<button onclick="" class='b-cta' title='Sign up now!'> CREATE ACCOUNT</button>
</div>
</div>
<!DOCTYPE html>
<html>
<head>
<style>
<link href="https://fonts.googleapis.com/css2?family=Concert+One&family=Francois+One&family=Satisfy&family=Staatliches&display=swap" rel="stylesheet">
* {
box-sizing: border-box;
}
body {
font-family: 'Concert One', cursive;
font-family: 'Francois One', sans-serif;
font-family: 'Satisfy', cursive;
font-family: 'Staatliches', cursive;
font-size: 13px
}
.header, .footer {
background-color:rgb(18, 18, 98);
color: white;
padding: 60px;
}
.column {
float: left;
padding: 30px;
}
.clearfix::after {
content: "";
clear: both;
display: table;
}
a{
color:white;
}
.menu {
width: 50%;
}
.content {
width: 50%;
}
.menu ul {
list-style-type: none;
margin: 0;
padding: 0;
}
.menu li {
padding: 8px;
margin-bottom: 8px;
background-color: rgb(18, 18, 98);
color: #ffffff;
}
.menu li:hover {
background-color: rgb(18, 18, 98);
}
</style>
</head>
<body>
<div class="header">
<h1> MENU TH</h1>
<h2> EN LOS SIGUIENTES LINKS PUEDE MODIFICAR, AGREGAR O ELIMINAR DATOS DE LA BASE DE DATOS DEL BOOTCAMP </h2>
</div>
<div class="column content">
<h1>PUEDE ACCEDER A LOS SIGUIENTES LINKS:</h1>
</div>
<div class="clearfix">
<div class="column menu">
<ul>
<li><a href="#"> MANAGE BOOTCAMP </a></li>
<li><a href="filtros-postulante"> MANAGE POSTULANTE </a></li>
<li><a href="#"> MANAGE LENGUAJES </a></li>
<li><a href="#"> MANAGE PROFESORES </a></li>
<li><a href="#"> USUARIO NUEVO (ADMINISTRADOR) </a></li>
</ul>
</div>
</div>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ taglib uri = "http://java.sun.com/jsp/jstl/core" prefix = "c" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Postulantes Manage</title>
</head>
<body>
<div>
<h1>Lista Postulantes</h1>
<form action="filtros-postulante" >
<input type="search" name="nombreBuscar"
placeholder="Buscar por nombre">
<button type="submit">Buscar</button>
</form>
<table>
<tr>
<th>#</th>
<th>Nombre</th>
<th>Apellido</th>
<th>Cedula</th>
<th>Correo</th>
<th>Telefono</th>
<th>Direccion</th>
<th>Experiencia laboral</th>
<th>Estudio universitario</th>
<th>
<form action="filtros-postulante" method="post">
<input type="hidden" name="nombre" value="notebook">
<button type="submit">Notebooks</button>
</form>
</th>
<th>
<form action="filtros-postulante" method="post">
<input type="search" name="nombre" placeholder="Buscar por Bootcamp" required>
<button type="submit">Bootcamp</button>
</form>
</th>
<th>
<form action="filtros-postulante" method="post">
<input type="hidden" name="nombre" value="aceptado">
<button type="submit">Aceptado</button>
</form>
</th>
<th></th>
</tr>
<tbody>
<c:forEach var="postulante" items="${postulantes}" varStatus="myIndex">
<tr>
<td> ${myIndex.index + 1}-</td>
<td> ${postulante.nombre}</td>
<td> ${postulante.apellido}</td>
<td> ${postulante.nroCedula}</td>
<td> ${postulante.correo}</td>
<td> ${postulante.telefono}</td>
<td> ${postulante.direccion}</td>
<td>
<c:if test="${postulante.expLaboral == true}">
SI
</c:if>
<c:if test="${postulante.expLaboral != true}">
NO
</c:if>
</td>
<td>
<c:if test="${postulante.estudioUniversitario == true}">
SI
</c:if>
<c:if test="${postulante.estudioUniversitario != true}">
NO
</c:if>
</td>
<td>
<c:if test="${postulante.notebook == true}">
SI
</c:if>
<c:if test="${postulante.notebook != true}">
NO
</c:if>
</td>
<td> ${postulante.nombreBootcamp}</td>
<td>
<c:if test="${postulante.aceptado == true}">
SI
</c:if>
<c:if test="${postulante.aceptado != true}">
NO
</c:if>
</td>
<td>
<c:if test="${postulante.aceptado == true}">
<input type="hidden" name="valor" value="false">
<button><a href="filtros-postulante?id=${postulante.id}">Rechazar</a></button>
</c:if>
<c:if test="${postulante.aceptado != true}">
<input type="hidden" name="valor" value="true">
<button><a href="filtros-postulante?id=${postulante.id}">Aceptar</a></button>
</c:if>
</td>
</tr>
</c:forEach>
</tbody>
</table>
</div>
</body>
</html>
\ No newline at end of file
<!--
Follow me on
------------
Codepen: https://codepen.io/mycnlz/
Dribbble: https://dribbble.com/mycnlz
Pinterest: https://pinterest.com/mycnlz/
-->
<div class='box'>
<div class='box-form'>
<div class='box-login-tab'></div>
<div class='box-login-title'>
<div class='i i-login'></div><h2> USUARIO </h2>
<link rel="stylesheet" href="usrebe.css">
<link rel="stylesheet" href="usrebe.js">
</div>
<div class='box-login'>
<div class='fieldset-body' id='login_form'>
<button onclick="openLoginInfo();" class='b b-form i i-more' title='Mais Informações'></button>
<p class='field'>
<label for='user'>E-MAIL</label>
<input type='text' id='user' name='user' title='Username' />
<span id='valida' class='i i-warning'></span>
</p>
<p class='field'>
<label for='pass'>PASSWORD</label>
<input type='password' id='pass' name='pass' title='Password' />
<span id='valida' class='i i-close'></span>
</p>
<input type='submit' id='do_login' value='INICIAR SESION' title='INICIAR SESION' />
</div>
</div>
</div>
<div class='box-info'>
<p><button onclick="closeLoginInfo();" class='b b-info i i-left' title='Back to Sign In'></button><h3>Need Help?</h3>
</p>
<div class='line-wh'></div>
<button onclick="" class='b-support' title='Forgot Password?'> Forgot Password?</button>
<button onclick="" class='b-support' title='Contact Support'> Contact Support</button>
<div class='line-wh'></div>
<button onclick="" class='b-cta' title='Sign up now!'> CREATE ACCOUNT</button>
</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