diff --git a/.gitignore b/.gitignore
index 75f0674..b3a52f7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,6 +4,7 @@ target/
!**/src/test/**/target/
### IntelliJ IDEA ###
+.idea/encodings.xml
.idea/**
.idea/modules.xml
.idea/jarRepositories.xml
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
index 94a25f7..35eb1dd 100644
--- a/.idea/vcs.xml
+++ b/.idea/vcs.xml
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/src/main/java/com/roshka/proyectofinal/DataBase.java b/src/main/java/com/roshka/proyectofinal/DataBase.java
index 13fdb92..12d2450 100644
--- a/src/main/java/com/roshka/proyectofinal/DataBase.java
+++ b/src/main/java/com/roshka/proyectofinal/DataBase.java
@@ -10,7 +10,7 @@ public class DataBase {
try{
Class.forName("org.postgresql.Driver");
con= DriverManager
- .getConnection("jdbc:postgresql://localhost:5432/Bootcamp_th",
+ .getConnection("jdbc:postgresql://localhost:5432/bootcamp_th",
"postgres", "postgres");
if(con != null){
diff --git a/src/main/java/com/roshka/proyectofinal/HelloServlet.java b/src/main/java/com/roshka/proyectofinal/HelloServlet.java
deleted file mode 100644
index 52997b6..0000000
--- a/src/main/java/com/roshka/proyectofinal/HelloServlet.java
+++ /dev/null
@@ -1,27 +0,0 @@
-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("
");
- out.println("" + message + "
");
- out.println("");
- }
-
- public void destroy() {
- }
-}
\ No newline at end of file
diff --git a/src/main/java/com/roshka/proyectofinal/entity/Lenguaje.java b/src/main/java/com/roshka/proyectofinal/entity/Lenguaje.java
index 3854cb2..eb6b90a 100644
--- a/src/main/java/com/roshka/proyectofinal/entity/Lenguaje.java
+++ b/src/main/java/com/roshka/proyectofinal/entity/Lenguaje.java
@@ -8,6 +8,14 @@ public class Lenguaje {
}
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
public String getNombre_lenguaje() {
return nombre_lenguaje;
}
diff --git a/src/main/java/com/roshka/proyectofinal/lenguaje/LenguajeDao.java b/src/main/java/com/roshka/proyectofinal/lenguaje/LenguajeDao.java
index f877529..8af253f 100644
--- a/src/main/java/com/roshka/proyectofinal/lenguaje/LenguajeDao.java
+++ b/src/main/java/com/roshka/proyectofinal/lenguaje/LenguajeDao.java
@@ -2,9 +2,14 @@ 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;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
public class LenguajeDao {
@@ -23,4 +28,25 @@ public class LenguajeDao {
return status;
}
-}
+
+ public static List listar(){
+ ArrayListlist = 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;
+ }
+ }
diff --git a/src/main/java/com/roshka/proyectofinal/lenguaje/ObtenerLenguaje.java b/src/main/java/com/roshka/proyectofinal/lenguaje/ObtenerLenguaje.java
new file mode 100644
index 0000000..a4d20e4
--- /dev/null
+++ b/src/main/java/com/roshka/proyectofinal/lenguaje/ObtenerLenguaje.java
@@ -0,0 +1,24 @@
+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 len = LenguajeDao.listar();
+ request.setAttribute("listaLenguaje", len);
+ RequestDispatcher rqd = request.getRequestDispatcher("./formulario_bootcamp.jsp");
+ rqd.forward(request, response);
+ }
+}
diff --git a/src/main/java/com/roshka/proyectofinal/lenguaje/SaveServlet.java b/src/main/java/com/roshka/proyectofinal/lenguaje/SaveServlet.java
index cd1b4fe..61b907c 100644
--- a/src/main/java/com/roshka/proyectofinal/lenguaje/SaveServlet.java
+++ b/src/main/java/com/roshka/proyectofinal/lenguaje/SaveServlet.java
@@ -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");
diff --git a/src/main/webapp/formulario_bootcamp.jsp b/src/main/webapp/formulario_bootcamp.jsp
new file mode 100644
index 0000000..def19c3
--- /dev/null
+++ b/src/main/webapp/formulario_bootcamp.jsp
@@ -0,0 +1,41 @@
+<%@ page language="java" contentType="text/html; charset=UTF-8"
+pageEncoding="UTF-8"%>
+
+
+
+
+
+ JSP Page
+
+
+
+
Crear Bootcamp
+
+ <%@ page import="com.roshka.proyectofinal.entity.Lenguaje, com.roshka.proyectofinal.lenguaje.LenguajeDao, java.util.List,java.util.Iterator" %>
+
+ <%
+ LenguajeDao lenDao = new LenguajeDao();
+ List listLenguaje = lenDao.listar();
+ Iterator iter = listLenguaje.iterator();
+ Lenguaje len = null;
+
+
+ %>
+
+
+
+
+
+
diff --git a/src/main/webapp/index.html b/src/main/webapp/index.html
index 86aff9e..9ca157c 100644
--- a/src/main/webapp/index.html
+++ b/src/main/webapp/index.html
@@ -26,11 +26,12 @@
>
diff --git a/src/main/webapp/index.jsp b/src/main/webapp/index.jsp
index bff22f6..705ff4a 100644
--- a/src/main/webapp/index.jsp
+++ b/src/main/webapp/index.jsp
@@ -1,3 +1,5 @@
+<<<<<<< HEAD
+=======
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
@@ -15,4 +17,5 @@
Postulate aqui
-