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
61e49c50
Commit
61e49c50
authored
May 13, 2022
by
Jose Baez
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'crearBootcamp' into 'develop'
Crear bootcamp See merge request
!14
parents
026d518c
32f2dd4a
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
115 additions
and
38 deletions
+115
-38
.gitignore
+1
-0
.idea/vcs.xml
+2
-1
src/main/java/com/roshka/proyectofinal/DataBase.java
+1
-1
src/main/java/com/roshka/proyectofinal/HelloServlet.java
+0
-28
src/main/java/com/roshka/proyectofinal/entity/Lenguaje.java
+8
-0
src/main/java/com/roshka/proyectofinal/lenguaje/LenguajeDao.java
+27
-1
src/main/java/com/roshka/proyectofinal/lenguaje/ObtenerLenguaje.java
+24
-0
src/main/java/com/roshka/proyectofinal/lenguaje/SaveServlet.java
+1
-0
src/main/webapp/formulario_bootcamp.jsp
+41
-0
src/main/webapp/index.html
+6
-5
src/main/webapp/index.jsp
+4
-2
No files found.
.gitignore
View file @
61e49c50
...
@@ -4,6 +4,7 @@ target/
...
@@ -4,6 +4,7 @@ target/
!**/src/test/**/target/
!**/src/test/**/target/
### IntelliJ IDEA ###
### IntelliJ IDEA ###
.idea/encodings.xml
.idea/**
.idea/**
.idea/modules.xml
.idea/modules.xml
.idea/jarRepositories.xml
.idea/jarRepositories.xml
...
...
.idea/vcs.xml
View file @
61e49c50
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<project
version=
"4"
>
<component
name=
"VcsDirectoryMappings"
>
<component
name=
"VcsDirectoryMappings"
>
<mapping
directory=
"
$PROJECT_DIR$
"
vcs=
"Git"
/>
<mapping
directory=
""
vcs=
"Git"
/>
</component>
</component>
</project>
</project>
\ No newline at end of file
src/main/java/com/roshka/proyectofinal/DataBase.java
View file @
61e49c50
...
@@ -10,7 +10,7 @@ public class DataBase {
...
@@ -10,7 +10,7 @@ public class DataBase {
try
{
try
{
Class
.
forName
(
"org.postgresql.Driver"
);
Class
.
forName
(
"org.postgresql.Driver"
);
con
=
DriverManager
con
=
DriverManager
.
getConnection
(
"jdbc:postgresql://localhost:5432/
B
ootcamp_th"
,
.
getConnection
(
"jdbc:postgresql://localhost:5432/
b
ootcamp_th"
,
"postgres"
,
"postgres"
);
"postgres"
,
"postgres"
);
if
(
con
!=
null
){
if
(
con
!=
null
){
...
...
src/main/java/com/roshka/proyectofinal/HelloServlet.java
deleted
100644 → 0
View file @
026d518c
package
com
.
roshka
.
proyectofinal
;
import
jakarta.servlet.annotation.WebServlet
;
import
jakarta.servlet.http.HttpServlet
;
import
jakarta.servlet.http.HttpServletRequest
;
import
jakarta.servlet.http.HttpServletResponse
;
import
java.io.*
;
@WebServlet
(
name
=
"helloServlet"
,
value
=
"/hello-servlet"
)
public
class
HelloServlet
extends
HttpServlet
{
private
String
message
=
"HOLA"
;
public
void
doGet
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
IOException
{
response
.
setContentType
(
"text/html"
);
// Hello
PrintWriter
out
=
response
.
getWriter
();
out
.
println
(
"<html><body>"
);
out
.
println
(
"<h1>"
+
message
+
"</h1>"
);
out
.
println
(
"</body></html>"
);
}
public
void
destroy
()
{
}
}
\ No newline at end of file
src/main/java/com/roshka/proyectofinal/entity/Lenguaje.java
View file @
61e49c50
...
@@ -8,6 +8,14 @@ public class Lenguaje {
...
@@ -8,6 +8,14 @@ public class Lenguaje {
}
}
public
int
getId
()
{
return
id
;
}
public
void
setId
(
int
id
)
{
this
.
id
=
id
;
}
public
String
getNombre_lenguaje
()
{
public
String
getNombre_lenguaje
()
{
return
nombre_lenguaje
;
return
nombre_lenguaje
;
}
}
...
...
src/main/java/com/roshka/proyectofinal/lenguaje/LenguajeDao.java
View file @
61e49c50
...
@@ -2,9 +2,14 @@ package com.roshka.proyectofinal.lenguaje;
...
@@ -2,9 +2,14 @@ package com.roshka.proyectofinal.lenguaje;
import
com.roshka.proyectofinal.DataBase
;
import
com.roshka.proyectofinal.DataBase
;
import
com.roshka.proyectofinal.entity.Lenguaje
;
import
com.roshka.proyectofinal.entity.Lenguaje
;
import
jakarta.servlet.RequestDispatcher
;
import
java.sql.Connection
;
import
java.sql.Connection
;
import
java.sql.PreparedStatement
;
import
java.sql.PreparedStatement
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
LenguajeDao
{
public
class
LenguajeDao
{
...
@@ -23,4 +28,25 @@ public class LenguajeDao {
...
@@ -23,4 +28,25 @@ public class LenguajeDao {
return
status
;
return
status
;
}
}
}
public
static
List
<
Lenguaje
>
listar
(){
ArrayList
<
Lenguaje
>
list
=
new
ArrayList
<>();
String
sql
=
"select * from lenguaje"
;
try
{
Connection
con
=
DataBase
.
getConnection
();
PreparedStatement
ps
=
con
.
prepareStatement
(
sql
);
ResultSet
rs
=
ps
.
executeQuery
();
while
(
rs
.
next
()){
Lenguaje
len
=
new
Lenguaje
();
len
.
setId
(
rs
.
getInt
(
"id"
));
len
.
setNombre_lenguaje
(
rs
.
getString
(
"nombre_lenguaje"
));
list
.
add
(
len
);
}
con
.
close
();
}
catch
(
SQLException
e
)
{
throw
new
RuntimeException
(
e
);
}
return
list
;
}
}
src/main/java/com/roshka/proyectofinal/lenguaje/ObtenerLenguaje.java
0 → 100644
View file @
61e49c50
package
com
.
roshka
.
proyectofinal
.
lenguaje
;
import
com.roshka.proyectofinal.entity.Lenguaje
;
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.List
;
@WebServlet
(
"/ProyectoFinal-Bootcamp/crearBootcamp"
)
public
class
ObtenerLenguaje
extends
HttpServlet
{
protected
void
doGet
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
ServletException
,
IOException
{
List
<
Lenguaje
>
len
=
LenguajeDao
.
listar
();
request
.
setAttribute
(
"listaLenguaje"
,
len
);
RequestDispatcher
rqd
=
request
.
getRequestDispatcher
(
"./formulario_bootcamp.jsp"
);
rqd
.
forward
(
request
,
response
);
}
}
src/main/java/com/roshka/proyectofinal/lenguaje/SaveServlet.java
View file @
61e49c50
...
@@ -10,6 +10,7 @@ import java.io.IOException;
...
@@ -10,6 +10,7 @@ import java.io.IOException;
import
java.io.PrintWriter
;
import
java.io.PrintWriter
;
public
class
SaveServlet
extends
HttpServlet
{
public
class
SaveServlet
extends
HttpServlet
{
protected
void
doPost
(
HttpServletRequest
request
,
HttpServletResponse
response
)
protected
void
doPost
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
ServletException
,
IOException
{
throws
ServletException
,
IOException
{
response
.
setContentType
(
"text/html"
);
response
.
setContentType
(
"text/html"
);
...
...
src/main/webapp/formulario_bootcamp.jsp
0 → 100644
View file @
61e49c50
<
%@
page
language=
"java"
contentType=
"text/html; charset=UTF-8"
pageEncoding=
"UTF-8"
%
>
<!DOCTYPE html>
<html>
<head>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=UTF-8"
>
<link
href=
"css/bootstrap.css"
rel=
"stylesheet"
type=
"text/css"
/>
<title>
JSP Page
</title>
</head>
<body>
<div
class=
"container"
>
<h1>
Crear Bootcamp
</h1>
<
%@
page
import=
"com.roshka.proyectofinal.entity.Lenguaje, com.roshka.proyectofinal.lenguaje.LenguajeDao, java.util.List,java.util.Iterator"
%
>
<
%
LenguajeDao
lenDao =
new
LenguajeDao
();
List
<
Lenguaje
>
listLenguaje = lenDao.listar();
Iterator
<Lenguaje>
iter = listLenguaje.iterator();
Lenguaje len = null;
%>
<form
action=
""
method=
"post"
>
<label
for=
"lenguaje"
>
Lenguajes:
</label>
<select
name=
"lenguaje"
id=
"lenguaje"
>
<
%
while
(
iter
.
hasNext
()){
len =
iter.next();
%
>
<option
value=
<%=
len
.
getId
()
%
>
>
<
%=
len
.
getNombre_lenguaje
()
%
>
</option>
<
%
}
%
>
</select>
</form>
</div>
</body>
</html>
src/main/webapp/index.html
View file @
61e49c50
...
@@ -26,11 +26,12 @@
...
@@ -26,11 +26,12 @@
>
<!-- logo con link -->
>
<!-- logo con link -->
</div>
</div>
<div
class=
"menu"
>
<div
class=
"menu"
>
<ul>
<ul>
<li
class=
"link-menu"
><a
href=
"formulario.html"
>
Postulate
</a></li>
<li
class=
"link-menu"
><a
href=
"/"
>
Home
</a></li>
<li
class=
"link-menu"
><a
href=
"/"
>
Home
</a></li>
<li
class=
"link-menu"
><a
href=
"./home.html"
>
Postulate
</a></li>
<li
class=
"link-menu"
><a
href=
"/ProyectoFinal-Bootcamp/crearBootcamp"
>
Crear bootcamp
</a>
</ul>
</li>
</ul>
</div>
</div>
<!-- menu -->
<!-- menu -->
</div>
</div>
...
...
src/main/webapp/index.jsp
View file @
61e49c50
<
<<<<<<
HEAD
=
======
<%@
page
contentType=
"text/html; charset=UTF-8"
pageEncoding=
"UTF-8"
%
>
<%@
page
contentType=
"text/html; charset=UTF-8"
pageEncoding=
"UTF-8"
%
>
<!DOCTYPE html>
<!DOCTYPE html>
<html>
<html>
...
@@ -15,4 +17,5 @@
...
@@ -15,4 +17,5 @@
<a
href=
"./formulario.html"
>
Postulate aqui
</a>
<a
href=
"./formulario.html"
>
Postulate aqui
</a>
</body>
</body>
</html>
</html>
\ No newline at end of file
>>>>>>> origin/develop
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