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
09231ba9
Commit
09231ba9
authored
May 12, 2022
by
Nahuel Mereles Rodriguez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Renderizado de lenguajes para la creacion de bootcamps
parent
25f6b840
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
48 additions
and
17 deletions
+48
-17
src/main/java/com/roshka/proyectofinal/DataBase.java
+1
-1
src/main/java/com/roshka/proyectofinal/ProtectedResource.java
+2
-3
src/main/java/com/roshka/proyectofinal/lenguaje/LenguajeDao.java
+3
-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
+15
-12
src/main/webapp/index.html
+2
-0
No files found.
src/main/java/com/roshka/proyectofinal/DataBase.java
View file @
09231ba9
...
@@ -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/ProtectedResource.java
View file @
09231ba9
package
com
.
roshka
.
proyectofinal
;
package
com
.
roshka
.
proyectofinal
;
import
jakarta.servlet.ServletException
;
import
jakarta.servlet.http.*
;
import
java.io.*
;
import
java.io.*
;
import
java.util.*
;
import
javax.servlet.*
;
import
javax.servlet.http.*
;
public
class
ProtectedResource
extends
HttpServlet
{
public
class
ProtectedResource
extends
HttpServlet
{
...
...
src/main/java/com/roshka/proyectofinal/lenguaje/LenguajeDao.java
View file @
09231ba9
...
@@ -2,6 +2,7 @@ package com.roshka.proyectofinal.lenguaje;
...
@@ -2,6 +2,7 @@ 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
;
...
@@ -28,7 +29,7 @@ public class LenguajeDao {
...
@@ -28,7 +29,7 @@ public class LenguajeDao {
return
status
;
return
status
;
}
}
public
List
listar
(
Lenguaje
l
){
public
static
List
<
Lenguaje
>
listar
(
){
ArrayList
<
Lenguaje
>
list
=
new
ArrayList
<>();
ArrayList
<
Lenguaje
>
list
=
new
ArrayList
<>();
String
sql
=
"select * from lenguaje"
;
String
sql
=
"select * from lenguaje"
;
try
{
try
{
...
@@ -41,6 +42,7 @@ public class LenguajeDao {
...
@@ -41,6 +42,7 @@ public class LenguajeDao {
len
.
setNombre_lenguaje
(
rs
.
getString
(
"nombre_lenguaje"
));
len
.
setNombre_lenguaje
(
rs
.
getString
(
"nombre_lenguaje"
));
list
.
add
(
len
);
list
.
add
(
len
);
}
}
con
.
close
();
con
.
close
();
}
catch
(
SQLException
e
)
{
}
catch
(
SQLException
e
)
{
throw
new
RuntimeException
(
e
);
throw
new
RuntimeException
(
e
);
...
...
src/main/java/com/roshka/proyectofinal/lenguaje/ObtenerLenguaje.java
0 → 100644
View file @
09231ba9
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 @
09231ba9
...
@@ -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
View file @
09231ba9
<
%@
page
import=
"java.util.Iterator"
%
>
<
%@
page
language=
"java"
contentType=
"text/html; charset=UTF-8"
<
%@
page
import=
"lenguaje.Lenguaje"
%
>
pageEncoding=
"UTF-8"
%
>
<
%@
page
import=
"java.util.List"
%
>
<
%@
page
import=
"Lenguaje.LenguajeDao"
%
>
<
%@
page
contentType=
"text/html"
pageEncoding=
"UTF-8"
%
>
<!DOCTYPE html>
<!DOCTYPE html>
<html>
<html>
<head>
<head>
...
@@ -14,20 +11,26 @@
...
@@ -14,20 +11,26 @@
<div
class=
"container"
>
<div
class=
"container"
>
<h1>
Crear Bootcamp
</h1>
<h1>
Crear Bootcamp
</h1>
<
%@
page
import=
"com.roshka.proyectofinal.entity.Lenguaje, com.roshka.proyectofinal.lenguaje.LenguajeDao, java.util.List,java.util.Iterator"
%
>
<
%
<
%
LenguajeDao
lenguajeDao=
new
LenguajeDao
();
LenguajeDao
lenDao =
new
LenguajeDao
();
List
<
Lenguaje
>
list=lenguajeDao.listar();
List
<
Lenguaje
>
listLenguaje = lenDao.listar();
Iterator
<Lenguaje>
iter=list.iterator();
Iterator
<Lenguaje>
iter = listLenguaje.iterator();
Lenguaje len=null;
Lenguaje len = null;
%>
%>
<form
action=
""
method=
"post"
>
<form
action=
""
method=
"post"
>
<label
for=
"lenguaje"
>
Lenguajes:
</label>
<label
for=
"lenguaje"
>
Lenguajes:
</label>
<select
name=
"lenguaje"
id=
"lenguaje"
>
<select
name=
"lenguaje"
id=
"lenguaje"
>
<
%
while
(
iter
.
hasNext
()){
<
%
while
(
iter
.
hasNext
()){
len=
iter.next();
%
>
len =
iter.next();
<option
value=
<%=
len
.
getId
()
%
>
>
%
>
<option
value=
<%=
len
.
getId
()
%
>
>
<
%=
len
.
getNombre_lenguaje
()
%
>
<
%=
len
.
getNombre_lenguaje
()
%
>
</option>
</option>
<
%
}
%
>
<
%
}
%
>
...
...
src/main/webapp/index.html
View file @
09231ba9
...
@@ -26,6 +26,8 @@
...
@@ -26,6 +26,8 @@
<ul>
<ul>
<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=
"./home.html"
>
Postulate
</a></li>
<li
class=
"link-menu"
><a
href=
"/ProyectoFinal-Bootcamp/crearBootcamp"
>
Crear bootcamp
</a>
</li>
</ul>
</ul>
</div>
</div>
<!-- menu -->
<!-- menu -->
...
...
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