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
3e42a461
Commit
3e42a461
authored
May 17, 2022
by
Jose Baez
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'sendemail3' into 'develop'
Arreglando errores traidos del pull See merge request
!39
parents
4b3ad9a6
e10e05ae
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
8 deletions
+51
-8
src/main/java/com/roshka/proyectofinal/profesor/EditServlet.java
+8
-8
src/main/java/com/roshka/proyectofinal/profesor/ProfesorDao.java
+43
-0
No files found.
src/main/java/com/roshka/proyectofinal/profesor/EditServlet.java
View file @
3e42a461
...
@@ -17,9 +17,9 @@ public class EditServlet extends HttpServlet {
...
@@ -17,9 +17,9 @@ public class EditServlet extends HttpServlet {
int
id
=
Integer
.
parseInt
(
request
.
getParameter
(
"id"
));
int
id
=
Integer
.
parseInt
(
request
.
getParameter
(
"id"
));
ProfesorDao
profesorDao
=
new
ProfesorDao
();
ProfesorDao
profesorDao
=
new
ProfesorDao
();
//
Profesor profesor = profesorDao.getProfesorById(id);
Profesor
profesor
=
profesorDao
.
getProfesorById
(
id
);
//
request.setAttribute("Profesor", profesor);
request
.
setAttribute
(
"Profesor"
,
profesor
);
RequestDispatcher
rd
=
request
.
getRequestDispatcher
(
"formulario_profesor.jsp"
);
RequestDispatcher
rd
=
request
.
getRequestDispatcher
(
"formulario_profesor.jsp"
);
rd
.
include
(
request
,
response
);
rd
.
include
(
request
,
response
);
}
}
...
@@ -36,13 +36,13 @@ public class EditServlet extends HttpServlet {
...
@@ -36,13 +36,13 @@ public class EditServlet extends HttpServlet {
Profesor
profesor
=
new
Profesor
(
nro_cedula
,
nombre
,
apellido
,
email
);
Profesor
profesor
=
new
Profesor
(
nro_cedula
,
nombre
,
apellido
,
email
);
profesor
.
setId
(
id
);
profesor
.
setId
(
id
);
//
int status=ProfesorDao.update(profesor);
int
status
=
ProfesorDao
.
update
(
profesor
);
//
if(status>0){
if
(
status
>
0
){
//
response.sendRedirect("formulario_profesor.jsp");
response
.
sendRedirect
(
"formulario_profesor.jsp"
);
//
}else{
}
else
{
//
System.out.println("Sorry! unable to update record");
System
.
out
.
println
(
"Sorry! unable to update record"
);
//
}
}
}
}
}
}
src/main/java/com/roshka/proyectofinal/profesor/ProfesorDao.java
View file @
3e42a461
...
@@ -80,6 +80,49 @@ public class ProfesorDao {
...
@@ -80,6 +80,49 @@ public class ProfesorDao {
}
}
return
profesores
;
return
profesores
;
}
}
public
static
int
update
(
Profesor
p
){
int
status
=
0
;
try
{
Connection
con
=
DataBase
.
getConnection
();
PreparedStatement
ps
=
con
.
prepareStatement
(
"update profesor set nombre=?, apellido=?, correo=?, nro_cedula=? where id=?"
);
ps
.
setString
(
1
,
p
.
getNombre
());
ps
.
setString
(
2
,
p
.
getApellido
());
ps
.
setString
(
3
,
p
.
getCorreo
());
ps
.
setInt
(
4
,
p
.
getNro_cedula
());
ps
.
setInt
(
5
,
p
.
getId
());
status
=
ps
.
executeUpdate
();
con
.
close
();
}
catch
(
Exception
ex
){
ex
.
printStackTrace
();}
return
status
;
}
public
static
Profesor
getProfesorById
(
int
id
){
Profesor
profesor
=
new
Profesor
();
try
{
Connection
con
=
DataBase
.
getConnection
();
PreparedStatement
ps
=
con
.
prepareStatement
(
"select * from profesor where id=?"
);
ps
.
setInt
(
1
,
id
);
ResultSet
rs
=
ps
.
executeQuery
();
if
(
rs
.
next
()){
profesor
.
setId
(
rs
.
getInt
(
1
));
profesor
.
setNombre
(
rs
.
getString
(
2
));
profesor
.
setApellido
(
rs
.
getString
(
3
));
profesor
.
setNro_cedula
(
rs
.
getInt
(
4
));
profesor
.
setCorreo
(
rs
.
getString
(
5
));
}
con
.
close
();
}
catch
(
Exception
ex
){
ex
.
printStackTrace
();}
return
profesor
;
}
public
static
int
delete
(
int
id
){
public
static
int
delete
(
int
id
){
int
status
=
0
;
int
status
=
0
;
try
{
try
{
...
...
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