Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
misuperproyecto
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
Nahuel Mereles Rodriguez
misuperproyecto
Commits
f775ac12
Commit
f775ac12
authored
May 13, 2022
by
Yovan Martinez
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'yovan' into develop
parents
9e3a0caa
81a14f18
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
152 additions
and
3 deletions
+152
-3
src/main/java/com/roshka/proyectofinal/Postulante/PostulanteDao.java
+33
-0
src/main/java/com/roshka/proyectofinal/Postulante/SaveServlet.java
+98
-0
src/main/webapp/formulario.html
+21
-3
No files found.
src/main/java/com/roshka/proyectofinal/Postulante/PostulanteDao.java
0 → 100644
View file @
f775ac12
package
com
.
roshka
.
proyectofinal
.
Postulante
;
import
com.roshka.proyectofinal.DataBase
;
import
com.roshka.proyectofinal.entity.Postulante
;
import
java.sql.Connection
;
import
java.sql.PreparedStatement
;
public
class
PostulanteDao
{
public
static
int
save
(
Postulante
postulante
){
int
status
=
0
;
try
{
Connection
con
=
DataBase
.
getConnection
();
PreparedStatement
ps
=
con
.
prepareStatement
(
"insert into postulante(nombre,apellido,nro_cedula,correo,telefono,direccion,experiencia_laboral,estudio_universitario,notebook,bootcamp_id,aceptado) values (?,?,?,?,?,?,?,?,?,?,?)"
);
ps
.
setString
(
1
,
postulante
.
getNombre
());
ps
.
setString
(
2
,
postulante
.
getApellido
());
ps
.
setInt
(
3
,
postulante
.
getNro_cedula
());
ps
.
setString
(
4
,
postulante
.
getCorreo
());
ps
.
setString
(
5
,
postulante
.
getTelefono
());
ps
.
setString
(
6
,
postulante
.
getDireccion
());
ps
.
setBoolean
(
7
,
postulante
.
getExpLaboral
());
ps
.
setBoolean
(
8
,
postulante
.
getEstudioUniversitario
());
ps
.
setBoolean
(
9
,
postulante
.
getNotebook
());
ps
.
setInt
(
10
,
postulante
.
getBootcampId
());
ps
.
setBoolean
(
11
,
postulante
.
getAceptado
());
status
=
ps
.
executeUpdate
();
con
.
close
();
}
catch
(
Exception
ex
){
ex
.
printStackTrace
();}
return
status
;
}
}
src/main/java/com/roshka/proyectofinal/Postulante/SaveServlet.java
0 → 100644
View file @
f775ac12
package
com
.
roshka
.
proyectofinal
.
Postulante
;
import
com.roshka.proyectofinal.DataBase
;
import
com.roshka.proyectofinal.entity.Postulante
;
import
com.roshka.proyectofinal.entity.Bootcamp
;
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.io.PrintWriter
;
import
java.sql.Connection
;
import
java.sql.PreparedStatement
;
import
java.sql.ResultSet
;
import
java.sql.Statement
;
@WebServlet
(
"/SaveServlet"
)
public
class
SaveServlet
extends
HttpServlet
{
protected
void
doPost
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
ServletException
,
IOException
{
response
.
setContentType
(
"text/html"
);
PrintWriter
out
=
response
.
getWriter
();
boolean
rechazarDatos
=
false
;
int
bootcampActual
=
3
;
try
{
Connection
con
=
DataBase
.
getConnection
();
//
Statement
stmt
=
con
.
createStatement
();
ResultSet
rs
=
stmt
.
executeQuery
(
"SELECT correo,bootcamp_id FROM postulante WHERE postulante.bootcamp_id ="
+
bootcampActual
);
//
String
nombre
=
request
.
getParameter
(
"nombre"
);
String
apellido
=
request
.
getParameter
(
"apellido"
);
int
cedula
=
Integer
.
parseInt
(
request
.
getParameter
(
"cedula"
));
String
correo
=
request
.
getParameter
(
"correo"
);
//BUCLE PARA VERIFICAR EL CORREO EN EL BOOTCAMP ACTUAL
while
(
rs
.
next
()){
String
correoBase
=
rs
.
getString
(
"correo"
);
int
bootcampIdBase
=
rs
.
getInt
(
"bootcamp_id"
);
if
(
correo
.
equals
(
correoBase
)
&&
(
bootcampIdBase
==
bootcampActual
)){
rechazarDatos
=
true
;
}
}
String
telefono
=
request
.
getParameter
(
"telefono"
);
String
direccion
=
request
.
getParameter
(
"direccion"
);
boolean
experienciaProgramando
=
false
;
boolean
experienciaLaboral
=
false
;
boolean
universidad
=
false
;
boolean
notebook
=
false
;
if
(
request
.
getParameter
(
"experiencia_laboral"
)
!=
null
){
experienciaLaboral
=
true
;
}
if
(
request
.
getParameter
(
"experiencia_programando"
)
!=
null
)
{
experienciaProgramando
=
true
;
}
if
(
request
.
getParameter
(
"notebook"
)
!=
null
){
notebook
=
true
;
}
if
(
request
.
getParameter
(
"universidad"
)
!=
null
){
universidad
=
true
;
}
Bootcamp
bootcamp
=
new
Bootcamp
();
Postulante
postulante
=
new
Postulante
();
//SI LOS DATOS SON CORRECTOS NO SE RECHAZAN ENTONCES CARGA A LA BASE
if
(!
rechazarDatos
){
postulante
.
setNombre
(
nombre
);
postulante
.
setApellido
(
apellido
);
postulante
.
setNro_cedula
(
cedula
);
postulante
.
setCorreo
(
correo
);
postulante
.
setTelefono
(
telefono
);
postulante
.
setDireccion
(
direccion
);
postulante
.
setExpLaboral
(
experienciaLaboral
);
postulante
.
setEstudioUniversitario
(
universidad
);
postulante
.
setNotebook
(
notebook
);
postulante
.
setBootcampId
(
bootcampActual
);
postulante
.
setAceptado
(
false
);
}
int
status
=
PostulanteDao
.
save
(
postulante
);
if
(
status
>
0
){
out
.
print
(
"<p>Record saved successfully!</p>"
);
request
.
getRequestDispatcher
(
"index.html"
).
include
(
request
,
response
);
}
else
{
if
(
rechazarDatos
){
out
.
println
(
"El correo ingresado ya esta registrado para el bootcamp actual"
);
}
else
{
out
.
println
(
"Sorry! unable to save record"
);
}
}
}
catch
(
Exception
ex
){
ex
.
printStackTrace
();
}
out
.
close
();
}
}
src/main/webapp/formulario.html
View file @
f775ac12
...
@@ -39,9 +39,27 @@
...
@@ -39,9 +39,27 @@
<label
for=
"experiencia_laboral"
>
Experiencia laboral
</label>
<label
for=
"experiencia_laboral"
>
Experiencia laboral
</label>
<!-- Si no lo marca el valor que envia es null y si lo marca es "ON" -->
<!-- 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>
<input
id=
"experiencia_laboral"
name=
"experiencia_laboral"
type=
"checkbox"
><br>
<p
for=
"experiencia_programando"
>
Lenguajes de programacion que conoces:
</p>
<label
for=
"experiencia_programando"
>
Lenguajes de programacion que conoces
</label>
<ul>
<input
id=
"experiencia_programando"
type=
"checkbox"
><br>
<li>
<label
for=
"ruby"
>
Ruby:
</label><input
id=
"ruby"
name=
"ruby"
type=
"checkbox"
><br>
</li>
<li>
<label
for=
"java"
>
Java:
</label><input
id=
"java"
name=
"java"
type=
"checkbox"
><br>
</li>
<li>
<label
for=
"python"
>
Python
</label><input
id=
"python"
name=
"python"
type=
"checkbox"
><br>
</li>
<li>
<label
for=
"c"
>
C++
</label><input
id=
"c"
name=
"c"
type=
"checkbox"
><br>
</li>
<li>
<label
for=
"javascript"
>
Javascript
</label><input
id=
"javascript"
name=
"javascript"
type=
"checkbox"
><br>
</li>
</ul>
<label
for=
"notebook"
>
Cuenta con notebook:
</label>
<label
for=
"notebook"
>
Cuenta con notebook:
</label>
<input
id=
"notebook"
name=
"notebook"
type=
"checkbox"
><br>
<input
id=
"notebook"
name=
"notebook"
type=
"checkbox"
><br>
...
...
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