Commit 743b2d19 by Francisco Javier

pagina de bienvenida

parent 5a3b8da6
...@@ -38,7 +38,6 @@ ...@@ -38,7 +38,6 @@
<scope>runtime</scope> <scope>runtime</scope>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
...@@ -47,5 +46,4 @@ ...@@ -47,5 +46,4 @@
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
</project> </project>
...@@ -21,6 +21,5 @@ public class FreeMarketApplication implements CommandLineRunner { ...@@ -21,6 +21,5 @@ public class FreeMarketApplication implements CommandLineRunner {
@Override @Override
public void run(String...args) throws Exception { public void run(String...args) throws Exception {
} }
} }
...@@ -7,6 +7,8 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -7,6 +7,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model; import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
...@@ -20,18 +22,22 @@ public class SalasController { ...@@ -20,18 +22,22 @@ public class SalasController {
private SalaRepository salaRepository; private SalaRepository salaRepository;
@GetMapping("/") @GetMapping("/")
public String index(Model model) { public String mostrarFormulario(Model modelo) {
modelo.addAttribute("titulo", "Página de Bienvenida");
return "bienvenida";
}
return "index"; @PostMapping("/")
public String procesarFormulario(@RequestParam("nombre") String nombre, Model modelo) {
modelo.addAttribute("titulo", "Página de Bienvenida");
modelo.addAttribute("nombre", nombre);
return "bienvenida";
} }
/*@GetMapping("/") @GetMapping("/index")
public ModelAndView home() { public String index(Model model) {
ModelAndView mv = new ModelAndView("home");
List<Sala> salas = salaRepository.findAll();
mv.addObject("salas", salas);
return mv;
}*/
return "index";
}
@GetMapping("/showSalas") @GetMapping("/showSalas")
public ModelAndView showCities(){ public ModelAndView showCities(){
List<Sala> salas = salaRepository.findAll(); List<Sala> salas = salaRepository.findAll();
......
...@@ -20,6 +20,13 @@ public class Sala { ...@@ -20,6 +20,13 @@ public class Sala {
this.tamano = tamano; this.tamano = tamano;
} }
public Sala(Sala sala) {
this.id = sala.id;
this.descripcion = sala.descripcion;
this.ubicacion = sala.ubicacion;
this.tamano = sala.tamano;
}
@Id @Id
@GeneratedValue(strategy = GenerationType.AUTO) @GeneratedValue(strategy = GenerationType.AUTO)
public Integer getId() { public Integer getId() {
......
<!DOCTYPE html>
<html>
<head>
<title>Home page</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T"
crossorigin="anonymous">
</head>
<body>
<#list salas as sala>
<tr>
<td>${sala.id}</td>
<td>${sala.descripcion}</td>
<td>${sala.ubicacion}</td>
<td>${sala.tamano}</td>
</tr>
</#list>
</body>
</html>
\ No newline at end of file
...@@ -8,18 +8,14 @@ ...@@ -8,18 +8,14 @@
rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T"
crossorigin="anonymous"> crossorigin="anonymous">
</head> </head>
<body> <body>
<div class="container"> <div class="container">
<div class="panel panel-primary"> <div class="panel panel-primary">
<div class="panel-heading"> <div class="panel-heading">
<h2>Pagina de inicio</h2> <h2>Pagina de inicio</h2>
</div> </div>
<a href="showSalas">Ver Salas (Recuperar datos de salas de la base de datos.)</a> <a href="showSalas" class="btn btn-outline-primary">Ver Salas (Recuperar datos de salas de la base de datos.)</a>
<br/>
<a href="home">home </a>
</div> </div>
</div> </div>
</body> </body>
</html> </html>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment