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
3483baec
Commit
3483baec
authored
May 16, 2022
by
Jose Baez
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'mejora-filtros' into 'develop'
Segunda mejora en filtro postulante See merge request
!24
parents
8706dabc
dca9fd2c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
100 additions
and
25 deletions
+100
-25
src/main/java/com/roshka/proyectofinal/Postulante/Filtros.java
+8
-2
src/main/java/com/roshka/proyectofinal/Postulante/PostulanteDao.java
+63
-11
src/main/webapp/postulante-consulta.jsp
+29
-12
No files found.
src/main/java/com/roshka/proyectofinal/Postulante/Filtros.java
View file @
3483baec
...
@@ -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 @
3483baec
...
@@ -73,17 +73,31 @@ public class PostulanteDao {
...
@@ -73,17 +73,31 @@ public class PostulanteDao {
return
postulante
;
return
postulante
;
}
}
public
static
void
update
(
int
id
){
public
static
void
update
(
int
id
,
Boolean
valor
){
try
{
if
(
valor
==
true
){
Connection
con
=
DataBase
.
getConnection
();
try
{
PreparedStatement
ps
=
con
.
prepareStatement
(
"update postulante set aceptado= true\n"
+
Connection
con
=
DataBase
.
getConnection
();
"where id=?"
);
PreparedStatement
ps
=
con
.
prepareStatement
(
"update postulante set aceptado= false\n"
+
ps
.
setInt
(
1
,
id
);
"where id=?"
);
ps
.
executeUpdate
();
ps
.
setInt
(
1
,
id
);
con
.
close
();
ps
.
executeUpdate
();
}
catch
(
Exception
ex
){
con
.
close
();
ex
.
printStackTrace
();
}
catch
(
Exception
ex
){
}
ex
.
printStackTrace
();
}
}
else
{
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
){
public
static
List
<
Postulante
>
buscarPorNombre
(
String
nombre
){
...
@@ -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 @
3483baec
...
@@ -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