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
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
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
52 additions
and
21 deletions
+52
-21
src/main/java/com/roshka/proyectofinal/DataBase.java
+1
-1
src/main/java/com/roshka/proyectofinal/ProtectedResource.java
+4
-5
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
+17
-14
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 {
try
{
Class
.
forName
(
"org.postgresql.Driver"
);
con
=
DriverManager
.
getConnection
(
"jdbc:postgresql://localhost:5432/
B
ootcamp_th"
,
.
getConnection
(
"jdbc:postgresql://localhost:5432/
b
ootcamp_th"
,
"postgres"
,
"postgres"
);
if
(
con
!=
null
){
...
...
src/main/java/com/roshka/proyectofinal/ProtectedResource.java
View file @
09231ba9
package
com
.
roshka
.
proyectofinal
;
import
java.io.*
;
import
java.util.*
;
import
javax.servlet.*
;
import
javax.servlet.http.*
;
import
jakarta.servlet.ServletException
;
import
jakarta.servlet.http.*
;
import
java.io.*
;
public
class
ProtectedResource
extends
HttpServlet
{
public
void
doGet
(
HttpServletRequest
req
,
HttpServletResponse
res
)
throws
ServletException
,
IOException
{
public
void
doGet
(
HttpServletRequest
req
,
HttpServletResponse
res
)
throws
ServletException
,
IOException
{
res
.
setContentType
(
"text/plain"
);
PrintWriter
out
=
res
.
getWriter
();
...
...
src/main/java/com/roshka/proyectofinal/lenguaje/LenguajeDao.java
View file @
09231ba9
...
...
@@ -2,6 +2,7 @@ package com.roshka.proyectofinal.lenguaje;
import
com.roshka.proyectofinal.DataBase
;
import
com.roshka.proyectofinal.entity.Lenguaje
;
import
jakarta.servlet.RequestDispatcher
;
import
java.sql.Connection
;
import
java.sql.PreparedStatement
;
...
...
@@ -28,7 +29,7 @@ public class LenguajeDao {
return
status
;
}
public
List
listar
(
Lenguaje
l
){
public
static
List
<
Lenguaje
>
listar
(
){
ArrayList
<
Lenguaje
>
list
=
new
ArrayList
<>();
String
sql
=
"select * from lenguaje"
;
try
{
...
...
@@ -41,6 +42,7 @@ public class LenguajeDao {
len
.
setNombre_lenguaje
(
rs
.
getString
(
"nombre_lenguaje"
));
list
.
add
(
len
);
}
con
.
close
();
}
catch
(
SQLException
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;
import
java.io.PrintWriter
;
public
class
SaveServlet
extends
HttpServlet
{
protected
void
doPost
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
ServletException
,
IOException
{
response
.
setContentType
(
"text/html"
);
...
...
src/main/webapp/formulario_bootcamp.jsp
View file @
09231ba9
<
%@
page
import=
"java.util.Iterator"
%
>
<
%@
page
import=
"lenguaje.Lenguaje"
%
>
<
%@
page
import=
"java.util.List"
%
>
<
%@
page
import=
"Lenguaje.LenguajeDao"
%
>
<
%@
page
contentType=
"text/html"
pageEncoding=
"UTF-8"
%
>
<
%@
page
language=
"java"
contentType=
"text/html; charset=UTF-8"
pageEncoding=
"UTF-8"
%
>
<!DOCTYPE html>
<html>
<head>
...
...
@@ -14,20 +11,26 @@
<div
class=
"container"
>
<h1>
Crear Bootcamp
</h1>
<
%
LenguajeDao
lenguajeDao=
new
LenguajeDao
();
List
<
Lenguaje
>
list=lenguajeDao.listar();
Iterator
<Lenguaje>
iter=list.iterator();
Lenguaje len=null;
%>
<
%@
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
()
%
>
>
<
%
while
(
iter
.
hasNext
()){
len =
iter.next();
%
>
<option
value=
<%=
len
.
getId
()
%
>
>
<
%=
len
.
getNombre_lenguaje
()
%
>
</option>
<
%
}
%
>
...
...
src/main/webapp/index.html
View file @
09231ba9
...
...
@@ -26,6 +26,8 @@
<ul>
<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>
</li>
</ul>
</div>
<!-- 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