Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
ProyectoFinal-Bootcamp
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jose Baez
ProyectoFinal-Bootcamp
Commits
8706dabc
Commit
8706dabc
authored
May 16, 2022
by
Jose Baez
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'filtros' into 'develop'
Filtros See merge request
!23
parents
83a3c531
bf6a607f
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
370 additions
and
1 deletions
+370
-1
src/main/java/com/roshka/proyectofinal/Postulante/Filtros.java
+55
-0
src/main/java/com/roshka/proyectofinal/Postulante/PostulanteDao.java
+168
-0
src/main/java/com/roshka/proyectofinal/entity/Postulante.java
+52
-0
src/main/webapp/menu.html
+1
-1
src/main/webapp/postulante-consulta.jsp
+94
-0
No files found.
src/main/java/com/roshka/proyectofinal/Postulante/Filtros.java
0 → 100644
View file @
8706dabc
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"
);
String
nombre
=
req
.
getParameter
(
"nombreBuscar"
)==
null
?
"0"
:
req
.
getParameter
(
"nombreBuscar"
);
System
.
out
.
println
(
nombre
);
if
(
respuesta
!=
null
)
{
update
(
Integer
.
parseInt
(
req
.
getParameter
(
"id"
)));
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
{
List
<
Postulante
>
postulantes
=
listarPorBootcamp
(
respuesta
);
req
.
getServletContext
().
setAttribute
(
"postulantes"
,
postulantes
);
RequestDispatcher
reqDisp
=
req
.
getRequestDispatcher
(
"postulante-consulta.jsp"
);
reqDisp
.
forward
(
req
,
resp
);
}
}
}
src/main/java/com/roshka/proyectofinal/Postulante/PostulanteDao.java
View file @
8706dabc
...
@@ -4,8 +4,13 @@ import com.roshka.proyectofinal.entity.Postulante;
...
@@ -4,8 +4,13 @@ import com.roshka.proyectofinal.entity.Postulante;
import
java.sql.Connection
;
import
java.sql.Connection
;
import
java.sql.PreparedStatement
;
import
java.sql.PreparedStatement
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
PostulanteDao
{
public
class
PostulanteDao
{
List
<
Postulante
>
postulante
=
null
;
public
static
int
save
(
Postulante
postulante
){
public
static
int
save
(
Postulante
postulante
){
int
status
=
0
;
int
status
=
0
;
...
@@ -30,4 +35,167 @@ public class PostulanteDao {
...
@@ -30,4 +35,167 @@ public class PostulanteDao {
return
status
;
return
status
;
}
}
public
static
List
<
Postulante
>
listarPostulante
(){
List
<
Postulante
>
postulante
=
new
ArrayList
<>();
String
sql
=
"select a.id, a.nombre, a.apellido, a.nro_cedula, a.correo, a.telefono, a.direccion, "
+
"a.experiencia_laboral, a.estudio_universitario, a.bootcamp_id, a.notebook, c.nombre_lenguaje as bootcamp, \n"
+
"a.aceptado from postulante a\n"
+
" inner join bootcamp b on b.id= a.bootcamp_id\n"
+
" inner join lenguaje c on c.id=b.id_lenguaje\n"
+
" order by a.id;"
;
try
{
Connection
con
=
DataBase
.
getConnection
();
PreparedStatement
ps
=
con
.
prepareStatement
(
sql
);
ResultSet
rs
=
ps
.
executeQuery
();
while
(
rs
.
next
()){
Postulante
postulanteObject
=
new
Postulante
();
postulanteObject
.
setId
(
rs
.
getInt
(
"id"
));
postulanteObject
.
setNombre
(
rs
.
getString
(
"nombre"
));
postulanteObject
.
setApellido
(
rs
.
getString
(
"apellido"
));
postulanteObject
.
setNroCedula
(
rs
.
getInt
(
"nro_cedula"
));
postulanteObject
.
setCorreo
(
rs
.
getString
(
"correo"
));
postulanteObject
.
setTelefono
(
rs
.
getString
(
"telefono"
));
postulanteObject
.
setDireccion
(
rs
.
getString
(
"direccion"
));
postulanteObject
.
setExpLaboral
(
rs
.
getBoolean
(
"experiencia_laboral"
));
postulanteObject
.
setEstudioUniversitario
(
rs
.
getBoolean
(
"estudio_universitario"
));
postulanteObject
.
setBootcampId
(
rs
.
getInt
(
"bootcamp_id"
));
postulanteObject
.
setNotebook
(
rs
.
getBoolean
(
"notebook"
));
postulanteObject
.
setNombreBootcamp
(
rs
.
getString
(
"bootcamp"
));
postulanteObject
.
setAceptado
(
rs
.
getBoolean
(
"aceptado"
));
postulante
.
add
(
postulanteObject
);
}
con
.
close
();
}
catch
(
SQLException
e
)
{
throw
new
RuntimeException
(
e
);
}
return
postulante
;
}
public
static
void
update
(
int
id
){
try
{
Connection
con
=
DataBase
.
getConnection
();
PreparedStatement
ps
=
con
.
prepareStatement
(
"update postulante set aceptado= true\n"
+
"where id=?"
);
ps
.
setInt
(
1
,
id
);
ps
.
executeUpdate
();
con
.
close
();
}
catch
(
Exception
ex
){
ex
.
printStackTrace
();
}
}
public
static
List
<
Postulante
>
buscarPorNombre
(
String
nombre
){
List
<
Postulante
>
postulante
=
null
;
Postulante
postulanteObject
=
null
;
try
{
Connection
con
=
DataBase
.
getConnection
();
PreparedStatement
ps
=
con
.
prepareStatement
(
"select a.id, a.nombre, a.apellido, a.nro_cedula, a.correo, "
+
"a.telefono, a.direccion, a.experiencia_laboral, a.estudio_universitario, a.bootcamp_id, a.notebook, "
+
"c.nombre_lenguaje as bootcamp, \n"
+
"a.aceptado from postulante a\n"
+
" inner join bootcamp b on b.id= a.bootcamp_id\n"
+
" inner join lenguaje c on c.id=b.id_lenguaje\n"
+
" where a.nombre ilike ? "
);
ps
.
setString
(
1
,
"%"
+
nombre
+
"%"
);
System
.
out
.
println
(
nombre
);
ResultSet
rs
=
ps
.
executeQuery
();
postulante
=
new
ArrayList
<>();
postulanteObject
=
new
Postulante
();
while
(
rs
.
next
()){
postulanteObject
.
setId
(
rs
.
getInt
(
"id"
));
postulanteObject
.
setNombre
(
rs
.
getString
(
"nombre"
));
postulanteObject
.
setApellido
(
rs
.
getString
(
"apellido"
));
postulanteObject
.
setNroCedula
(
rs
.
getInt
(
"nro_cedula"
));
postulanteObject
.
setCorreo
(
rs
.
getString
(
"correo"
));
postulanteObject
.
setTelefono
(
rs
.
getString
(
"telefono"
));
postulanteObject
.
setDireccion
(
rs
.
getString
(
"direccion"
));
postulanteObject
.
setExpLaboral
(
rs
.
getBoolean
(
"experiencia_laboral"
));
postulanteObject
.
setEstudioUniversitario
(
rs
.
getBoolean
(
"estudio_universitario"
));
postulanteObject
.
setBootcampId
(
rs
.
getInt
(
"bootcamp_id"
));
postulanteObject
.
setNotebook
(
rs
.
getBoolean
(
"notebook"
));
postulanteObject
.
setNombreBootcamp
(
rs
.
getString
(
"bootcamp"
));
postulanteObject
.
setAceptado
(
rs
.
getBoolean
(
"aceptado"
));
postulante
.
add
(
postulanteObject
);
}
con
.
close
();
}
catch
(
Exception
ex
){
ex
.
printStackTrace
();
}
return
postulante
;
}
public
static
List
<
Postulante
>
listarPostulanteAceptados
(){
List
<
Postulante
>
postulante
=
null
;
try
{
Connection
con
=
DataBase
.
getConnection
();
PreparedStatement
ps
=
con
.
prepareStatement
(
"select a.id, a.nombre, a.apellido, a.nro_cedula, a.correo, "
+
"a.telefono, a.direccion, a.experiencia_laboral, a.estudio_universitario, a.bootcamp_id, a.notebook, "
+
"c.nombre_lenguaje as bootcamp, \n"
+
"a.aceptado from postulante a\n"
+
" inner join bootcamp b on b.id= a.bootcamp_id\n"
+
" inner join lenguaje c on c.id=b.id_lenguaje\n"
+
" where a.aceptado= true "
);
ResultSet
rs
=
ps
.
executeQuery
();
postulante
=
new
ArrayList
<>();
Postulante
postulanteObject
=
new
Postulante
();
while
(
rs
.
next
()){
postulanteObject
.
setId
(
rs
.
getInt
(
"id"
));
postulanteObject
.
setNombre
(
rs
.
getString
(
"nombre"
));
postulanteObject
.
setApellido
(
rs
.
getString
(
"apellido"
));
postulanteObject
.
setNroCedula
(
rs
.
getInt
(
"nro_cedula"
));
postulanteObject
.
setCorreo
(
rs
.
getString
(
"correo"
));
postulanteObject
.
setTelefono
(
rs
.
getString
(
"telefono"
));
postulanteObject
.
setDireccion
(
rs
.
getString
(
"direccion"
));
postulanteObject
.
setExpLaboral
(
rs
.
getBoolean
(
"experiencia_laboral"
));
postulanteObject
.
setEstudioUniversitario
(
rs
.
getBoolean
(
"estudio_universitario"
));
postulanteObject
.
setBootcampId
(
rs
.
getInt
(
"bootcamp_id"
));
postulanteObject
.
setNotebook
(
rs
.
getBoolean
(
"notebook"
));
postulanteObject
.
setNombreBootcamp
(
rs
.
getString
(
"bootcamp"
));
postulanteObject
.
setAceptado
(
rs
.
getBoolean
(
"aceptado"
));
postulante
.
add
(
postulanteObject
);
}
con
.
close
();
}
catch
(
Exception
ex
){
ex
.
printStackTrace
();
}
return
postulante
;
}
public
static
List
<
Postulante
>
listarPorBootcamp
(
String
nombre
){
List
<
Postulante
>
postulante
=
null
;
try
{
Connection
con
=
DataBase
.
getConnection
();
PreparedStatement
ps
=
con
.
prepareStatement
(
"select a.id, a.nombre, a.apellido, a.nro_cedula, a.correo, a.telefono, a.direccion, \n"
+
" a.experiencia_laboral, a.estudio_universitario, a.bootcamp_id, a.notebook, c.nombre_lenguaje as bootcamp, \n"
+
" a.aceptado from postulante a\n"
+
" inner join bootcamp b on b.id= a.bootcamp_id\n"
+
" inner join lenguaje c on c.id=b.id_lenguaje\n"
+
" where c.nombre_lenguaje ilike ? "
);
ps
.
setString
(
1
,
"%"
+
nombre
+
"%"
);
ResultSet
rs
=
ps
.
executeQuery
();
postulante
=
new
ArrayList
<>();
Postulante
postulanteObject
=
new
Postulante
();
while
(
rs
.
next
()){
postulanteObject
.
setId
(
rs
.
getInt
(
"id"
));
postulanteObject
.
setNombre
(
rs
.
getString
(
"nombre"
));
postulanteObject
.
setApellido
(
rs
.
getString
(
"apellido"
));
postulanteObject
.
setNroCedula
(
rs
.
getInt
(
"nro_cedula"
));
postulanteObject
.
setCorreo
(
rs
.
getString
(
"correo"
));
postulanteObject
.
setTelefono
(
rs
.
getString
(
"telefono"
));
postulanteObject
.
setDireccion
(
rs
.
getString
(
"direccion"
));
postulanteObject
.
setExpLaboral
(
rs
.
getBoolean
(
"experiencia_laboral"
));
postulanteObject
.
setEstudioUniversitario
(
rs
.
getBoolean
(
"estudio_universitario"
));
postulanteObject
.
setBootcampId
(
rs
.
getInt
(
"bootcamp_id"
));
postulanteObject
.
setNotebook
(
rs
.
getBoolean
(
"notebook"
));
postulanteObject
.
setNombreBootcamp
(
rs
.
getString
(
"bootcamp"
));
postulanteObject
.
setAceptado
(
rs
.
getBoolean
(
"aceptado"
));
postulante
.
add
(
postulanteObject
);
}
con
.
close
();
}
catch
(
Exception
ex
){
ex
.
printStackTrace
();
}
return
postulante
;
}
}
}
src/main/java/com/roshka/proyectofinal/entity/Postulante.java
View file @
8706dabc
...
@@ -5,6 +5,7 @@ package com.roshka.proyectofinal.entity;
...
@@ -5,6 +5,7 @@ package com.roshka.proyectofinal.entity;
public
class
Postulante
{
public
class
Postulante
{
private
int
id
,
nroCedula
,
bootcampId
;
private
int
id
,
nroCedula
,
bootcampId
;
private
String
nombreBootcamp
;
private
String
nombre
,
apellido
,
telefono
,
direccion
,
correo
;
private
String
nombre
,
apellido
,
telefono
,
direccion
,
correo
;
private
boolean
expLaboral
,
estudioUniversitario
,
notebook
,
aceptado
;
private
boolean
expLaboral
,
estudioUniversitario
,
notebook
,
aceptado
;
...
@@ -27,6 +28,22 @@ public class Postulante {
...
@@ -27,6 +28,22 @@ public class Postulante {
this
.
bootcampId
=
bootcampId
;
this
.
bootcampId
=
bootcampId
;
this
.
aceptado
=
aceptado
;
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
()
{
public
int
getId
()
{
return
id
;
return
id
;
}
}
...
@@ -97,4 +114,39 @@ public class Postulante {
...
@@ -97,4 +114,39 @@ public class Postulante {
this
.
bootcampId
=
bootcampId
;
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
;
}
}
}
src/main/webapp/menu.html
View file @
8706dabc
...
@@ -81,7 +81,7 @@ a{
...
@@ -81,7 +81,7 @@ a{
<div
class=
"column menu"
>
<div
class=
"column menu"
>
<ul>
<ul>
<li><a
href=
"#"
>
MANAGE BOOTCAMP
</a></li>
<li><a
href=
"#"
>
MANAGE BOOTCAMP
</a></li>
<li><a
href=
"
#
"
>
MANAGE POSTULANTE
</a></li>
<li><a
href=
"
filtros-postulante
"
>
MANAGE POSTULANTE
</a></li>
<li><a
href=
"#"
>
MANAGE LENGUAJES
</a></li>
<li><a
href=
"#"
>
MANAGE LENGUAJES
</a></li>
<li><a
href=
"#"
>
MANAGE PROFESORES
</a></li>
<li><a
href=
"#"
>
MANAGE PROFESORES
</a></li>
<li><a
href=
"#"
>
USUARIO NUEVO (ADMINISTRADOR)
</a></li>
<li><a
href=
"#"
>
USUARIO NUEVO (ADMINISTRADOR)
</a></li>
...
...
src/main/webapp/postulante-consulta.jsp
0 → 100644
View file @
8706dabc
<
%@
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>
<form
action=
"filtros-postulante"
method=
"post"
>
<input
type=
"hidden"
name=
"nombre"
value=
"aceptado"
>
<button
type=
"submit"
>
Aceptados
</button>
</form>
<form
action=
"filtros-postulante"
method=
"post"
>
<input
type=
"search"
name=
"nombre"
placeholder=
"Buscar por Bootcamp"
>
<button
type=
"submit"
>
Bootcamp
</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>
Notebook
</th>
<th>
Bootcamp
</th>
<th>
Aceptado
</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}"
>
<button><a
href=
"filtros-postulante?id=${postulante.id}"
>
Aceptar postulante
</a></button>
</c:if>
</td>
</tr>
</c:forEach>
</tbody>
</table>
</div>
</body>
</html>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment