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
28ebb919
Commit
28ebb919
authored
May 15, 2022
by
Josebaezx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Se crea vista postulante manager
parent
70ad930e
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
221 additions
and
7 deletions
+221
-7
src/main/java/com/roshka/proyectofinal/Postulante/Filtros.java
+16
-1
src/main/java/com/roshka/proyectofinal/Postulante/PostulanteDao.java
+95
-0
src/main/java/com/roshka/proyectofinal/entity/Postulante.java
+52
-0
src/main/webapp/postulante-consulta.jsp
+58
-6
No files found.
src/main/java/com/roshka/proyectofinal/Postulante/Filtros.java
View file @
28ebb919
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"
);
if
(
respuesta
!=
null
)
{
update
(
Integer
.
parseInt
(
req
.
getParameter
(
"id"
)));
}
else
if
(
nombre
!=
null
){
postulantes
=
buscarPorNombre
(
nombre
);
}
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 @
28ebb919
...
...
@@ -4,8 +4,13 @@ import com.roshka.proyectofinal.entity.Postulante;
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
PostulanteDao
{
List
<
Postulante
>
postulante
=
null
;
public
static
int
save
(
Postulante
postulante
){
int
status
=
0
;
...
...
@@ -30,4 +35,94 @@ public class PostulanteDao {
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
;
}
}
src/main/java/com/roshka/proyectofinal/entity/Postulante.java
View file @
28ebb919
...
...
@@ -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
;
}
}
src/main/webapp/postulante-consulta.jsp
View file @
28ebb919
<
%@
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
PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "https://www.w3.org/TR/html4/loose.dtd"
>
<!DOCTYPE html>
<html>
<head>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=ISO-8859-1"
>
<title>
Postulantes Manage
</title>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=ISO-8859-1"
>
<title>
Postulantes Manage
</title>
</head>
<body>
<div>
<h1>
${"HOLA JSTL"}
</h1>
</div>
<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>
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>
${postulante.expLaboral}
</td>
<td>
${postulante.estudioUniversitario}
</td>
<td>
${postulante.notebook}
</td>
<td>
${postulante.nombreBootcamp}
</td>
<td>
${postulante.aceptado}
</td>
<td>
<c:if
test=
"${postulante.aceptado == true}"
>
<button>
Aceptado
</button>
</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