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
dca9fd2c
Commit
dca9fd2c
authored
May 16, 2022
by
Jose Baez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Segunda mejora en filtro postulante
parent
8706dabc
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
90 additions
and
15 deletions
+90
-15
src/main/java/com/roshka/proyectofinal/Postulante/Filtros.java
+8
-2
src/main/java/com/roshka/proyectofinal/Postulante/PostulanteDao.java
+53
-1
src/main/webapp/postulante-consulta.jsp
+29
-12
No files found.
src/main/java/com/roshka/proyectofinal/Postulante/Filtros.java
View file @
dca9fd2c
...
@@ -20,10 +20,11 @@ public class Filtros extends HttpServlet {
...
@@ -20,10 +20,11 @@ public class Filtros extends HttpServlet {
protected
void
doGet
(
HttpServletRequest
req
,
HttpServletResponse
resp
)
throws
ServletException
,
IOException
{
protected
void
doGet
(
HttpServletRequest
req
,
HttpServletResponse
resp
)
throws
ServletException
,
IOException
{
List
<
Postulante
>
postulantes
=
listarPostulante
();
List
<
Postulante
>
postulantes
=
listarPostulante
();
String
respuesta
=
req
.
getParameter
(
"id"
);
String
respuesta
=
req
.
getParameter
(
"id"
);
boolean
valor
=
Boolean
.
parseBoolean
(
req
.
getParameter
(
"valor"
));
String
nombre
=
req
.
getParameter
(
"nombreBuscar"
)==
null
?
"0"
:
req
.
getParameter
(
"nombreBuscar"
);
String
nombre
=
req
.
getParameter
(
"nombreBuscar"
)==
null
?
"0"
:
req
.
getParameter
(
"nombreBuscar"
);
System
.
out
.
println
(
nombre
);
System
.
out
.
println
(
nombre
);
if
(
respuesta
!=
null
)
{
if
(
respuesta
!=
null
)
{
update
(
Integer
.
parseInt
(
req
.
getParameter
(
"id"
)));
update
(
Integer
.
parseInt
(
req
.
getParameter
(
"id"
))
,
valor
);
postulantes
=
listarPostulante
();
postulantes
=
listarPostulante
();
}
else
if
(
nombre
.
length
()
>
1
){
}
else
if
(
nombre
.
length
()
>
1
){
postulantes
=
buscarPorNombre
(
nombre
);
postulantes
=
buscarPorNombre
(
nombre
);
...
@@ -43,7 +44,12 @@ public class Filtros extends HttpServlet {
...
@@ -43,7 +44,12 @@ public class Filtros extends HttpServlet {
req
.
getServletContext
().
setAttribute
(
"postulantes"
,
postulantes
);
req
.
getServletContext
().
setAttribute
(
"postulantes"
,
postulantes
);
RequestDispatcher
reqDisp
=
req
.
getRequestDispatcher
(
"postulante-consulta.jsp"
);
RequestDispatcher
reqDisp
=
req
.
getRequestDispatcher
(
"postulante-consulta.jsp"
);
reqDisp
.
forward
(
req
,
resp
);
reqDisp
.
forward
(
req
,
resp
);
}
else
{
}
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
);
List
<
Postulante
>
postulantes
=
listarPorBootcamp
(
respuesta
);
req
.
getServletContext
().
setAttribute
(
"postulantes"
,
postulantes
);
req
.
getServletContext
().
setAttribute
(
"postulantes"
,
postulantes
);
RequestDispatcher
reqDisp
=
req
.
getRequestDispatcher
(
"postulante-consulta.jsp"
);
RequestDispatcher
reqDisp
=
req
.
getRequestDispatcher
(
"postulante-consulta.jsp"
);
...
...
src/main/java/com/roshka/proyectofinal/Postulante/PostulanteDao.java
View file @
dca9fd2c
...
@@ -73,7 +73,19 @@ public class PostulanteDao {
...
@@ -73,7 +73,19 @@ public class PostulanteDao {
return
postulante
;
return
postulante
;
}
}
public
static
void
update
(
int
id
){
public
static
void
update
(
int
id
,
Boolean
valor
){
if
(
valor
==
true
){
try
{
Connection
con
=
DataBase
.
getConnection
();
PreparedStatement
ps
=
con
.
prepareStatement
(
"update postulante set aceptado= false\n"
+
"where id=?"
);
ps
.
setInt
(
1
,
id
);
ps
.
executeUpdate
();
con
.
close
();
}
catch
(
Exception
ex
){
ex
.
printStackTrace
();
}
}
else
{
try
{
try
{
Connection
con
=
DataBase
.
getConnection
();
Connection
con
=
DataBase
.
getConnection
();
PreparedStatement
ps
=
con
.
prepareStatement
(
"update postulante set aceptado= true\n"
+
PreparedStatement
ps
=
con
.
prepareStatement
(
"update postulante set aceptado= true\n"
+
...
@@ -86,6 +98,8 @@ public class PostulanteDao {
...
@@ -86,6 +98,8 @@ public class PostulanteDao {
}
}
}
}
}
public
static
List
<
Postulante
>
buscarPorNombre
(
String
nombre
){
public
static
List
<
Postulante
>
buscarPorNombre
(
String
nombre
){
List
<
Postulante
>
postulante
=
null
;
List
<
Postulante
>
postulante
=
null
;
Postulante
postulanteObject
=
null
;
Postulante
postulanteObject
=
null
;
...
@@ -198,4 +212,42 @@ public class PostulanteDao {
...
@@ -198,4 +212,42 @@ public class PostulanteDao {
}
}
return
postulante
;
return
postulante
;
}
}
public
static
List
<
Postulante
>
buscarPorNoteBook
(){
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.notebook=true "
);
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
;
}
}
}
src/main/webapp/postulante-consulta.jsp
View file @
dca9fd2c
...
@@ -16,14 +16,6 @@
...
@@ -16,14 +16,6 @@
placeholder=
"Buscar por nombre"
>
placeholder=
"Buscar por nombre"
>
<button
type=
"submit"
>
Buscar
</button>
<button
type=
"submit"
>
Buscar
</button>
</form>
</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>
<table>
<tr>
<tr>
<th>
#
</th>
<th>
#
</th>
...
@@ -35,9 +27,24 @@
...
@@ -35,9 +27,24 @@
<th>
Direccion
</th>
<th>
Direccion
</th>
<th>
Experiencia laboral
</th>
<th>
Experiencia laboral
</th>
<th>
Estudio universitario
</th>
<th>
Estudio universitario
</th>
<th>
Notebook
</th>
<th>
<th>
Bootcamp
</th>
<form
action=
"filtros-postulante"
method=
"post"
>
<th>
Aceptado
</th>
<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>
<th></th>
</tr>
</tr>
<tbody>
<tbody>
...
@@ -80,7 +87,17 @@
...
@@ -80,7 +87,17 @@
SI
SI
</c:if>
</c:if>
<c:if
test=
"${postulante.aceptado != true}"
>
<c:if
test=
"${postulante.aceptado != true}"
>
<button><a
href=
"filtros-postulante?id=${postulante.id}"
>
Aceptar postulante
</a></button>
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>
</c:if>
</td>
</td>
</tr>
</tr>
...
...
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