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
644d0014
Commit
644d0014
authored
2 years ago
by
Yovan Martinez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Editado formulario, creacion de postulanteDao,SaveServlet,correccion errores Postulante
parent
c0947e8e
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
73 additions
and
17 deletions
+73
-17
src/main/java/Postulante/PostulanteDao.java
+3
-11
src/main/java/Postulante/SaveServlet.java
+64
-0
src/main/java/entity/Postulante.java
+1
-1
src/main/webapp/formulario.html
+5
-5
No files found.
src/main/java/Postulante/PostulanteDao.java
View file @
644d0014
package
Postulante
;
import
com.roshka.proyectofinal.DataBase
;
import
com.roshka.proyectofinal.Postulante
;
import
java.util.*
;
...
...
@@ -6,18 +7,11 @@ import java.sql.*;
public
class
PostulanteDao
{
public
static
Connection
getConnection
(){
Connection
con
=
null
;
try
{
Class
.
forName
(
"oracle.jdbc.driver.OracleDriver"
);
con
=
DriverManager
.
getConnection
(
"jdbc:oracle:thin:@localhost:1521:xe"
,
"system"
,
"oracle"
);
}
catch
(
Exception
e
){
System
.
out
.
println
(
e
);}
return
con
;
}
public
static
int
save
(
Postulante
postulante
){
int
status
=
0
;
try
{
Connection
con
=
PostulanteDao
.
getConnection
();
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
());
...
...
@@ -31,9 +25,7 @@ public class PostulanteDao {
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
();}
...
...
This diff is collapsed.
Click to expand it.
src/main/java/Postulante/SaveServlet.java
0 → 100644
View file @
644d0014
package
Postulante
;
import
com.roshka.proyectofinal.Postulante
;
import
jakarta.servlet.ServletException
;
import
jakarta.servlet.annotation.WebServlet
;
import
jakarta.servlet.http.HttpServletRequest
;
import
jakarta.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.io.PrintWriter
;
@WebServlet
(
"/SaveServlet"
)
public
class
SaveServlet
{
protected
void
doPost
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
ServletException
,
IOException
{
response
.
setContentType
(
"text/html"
);
PrintWriter
out
=
response
.
getWriter
();
String
nombre
=
request
.
getParameter
(
"nombre"
);
String
apellido
=
request
.
getParameter
(
"apellido"
);
int
cedula
=
Integer
.
parseInt
(
request
.
getParameter
(
"cedula"
));
String
correo
=
request
.
getParameter
(
"correo"
);
String
telefono
=
request
.
getParameter
(
"telefono"
);
String
direccion
=
request
.
getParameter
(
"direccion"
);
boolean
experienciaProgramando
=
false
;
boolean
experienciaLaboral
=
false
;
boolean
universidad
=
false
;
if
(
request
.
getParameter
(
"experiencia_laboral"
)
!=
null
){
experienciaLaboral
=
true
;
}
if
(
request
.
getParameter
(
"experiencia_programando"
)
!=
null
)
{
experienciaProgramando
=
true
;
}
if
(
request
.
getParameter
(
"notebook"
)
!=
null
){
boolean
notebook
=
true
;
}
if
(
request
.
getParameter
(
"universidad"
)
!=
null
){
universidad
=
true
;
}
Postulante
postulante
=
new
Postulante
();
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
);
int
status
=
PostulanteDao
.
save
(
postulante
);
if
(
status
>
0
){
out
.
print
(
"<p>Record saved successfully!</p>"
);
request
.
getRequestDispatcher
(
"index.html"
).
include
(
request
,
response
);
}
else
{
out
.
println
(
"Sorry! unable to save record"
);
}
out
.
close
();
}
}
This diff is collapsed.
Click to expand it.
src/main/java/entity/Postulante.java
View file @
644d0014
...
...
@@ -38,7 +38,7 @@ public class Postulante {
public
String
getNombre
()
{
return
nombre
;
}
public
void
setN
am
e
(
String
name
)
{
public
void
setN
ombr
e
(
String
name
)
{
this
.
nombre
=
name
;
}
public
String
getApellido
()
{
...
...
This diff is collapsed.
Click to expand it.
src/main/webapp/formulario.html
View file @
644d0014
...
...
@@ -18,8 +18,8 @@
<form
action=
""
>
<label
for=
"
apellido
"
>
Ingrese su Nombre:
</label>
<input
required
id=
"
apellido
"
type=
"text"
><br>
<label
for=
"
nombre
"
>
Ingrese su Nombre:
</label>
<input
required
id=
"
nombre
"
type=
"text"
><br>
<label
for=
"apellido"
>
Ingrese su Apellido:
</label>
<input
required
id=
"apellido"
type=
"text"
><br>
...
...
@@ -36,13 +36,13 @@
<label
for=
"direccion"
>
Direccion:
</label>
<input
required
id=
"direccion"
type=
"text"
><br>
<label
for=
"experiencia_programando"
>
Tienes experiencia programando
</label>
<input
id=
"experiencia_programando"
type=
"checkbox"
><br>
<label
for=
"experiencia_laboral"
>
Experiencia laboral
</label>
<!-- Si no lo marca el valor que envia es null y si lo marca es "ON" -->
<input
id=
"experiencia_laboral"
type=
"checkbox"
><br>
<label
for=
"experiencia_programando"
>
Tienes experiencia programando
</label>
<input
id=
"experiencia_programando"
type=
"checkbox"
><br>
<label
for=
"notebook"
>
Cuenta con notebook:
</label>
<input
id=
"notebook"
type=
"checkbox"
><br>
...
...
This diff is collapsed.
Click to expand it.
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