Commit 743b2d19 by Francisco Javier

pagina de bienvenida

parent 5a3b8da6
......@@ -38,7 +38,6 @@
<scope>runtime</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
......@@ -47,5 +46,4 @@
</plugin>
</plugins>
</build>
</project>
......@@ -21,6 +21,5 @@ public class FreeMarketApplication implements CommandLineRunner {
@Override
public void run(String...args) throws Exception {
}
}
......@@ -7,6 +7,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
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;
......@@ -20,18 +22,22 @@ public class SalasController {
private SalaRepository salaRepository;
@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("/")
public ModelAndView home() {
ModelAndView mv = new ModelAndView("home");
List<Sala> salas = salaRepository.findAll();
mv.addObject("salas", salas);
return mv;
}*/
@GetMapping("/index")
public String index(Model model) {
return "index";
}
@GetMapping("/showSalas")
public ModelAndView showCities(){
List<Sala> salas = salaRepository.findAll();
......
......@@ -20,6 +20,13 @@ public class Sala {
this.tamano = tamano;
}
public Sala(Sala sala) {
this.id = sala.id;
this.descripcion = sala.descripcion;
this.ubicacion = sala.ubicacion;
this.tamano = sala.tamano;
}
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
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 @@
rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T"
crossorigin="anonymous">
</head>
<body>
<div class="container">
<div class="panel panel-primary">
<div class="panel-heading">
<h2>Pagina de inicio</h2>
</div>
<a href="showSalas">Ver Salas (Recuperar datos de salas de la base de datos.)</a>
<br/>
<a href="home">home </a>
<a href="showSalas" class="btn btn-outline-primary">Ver Salas (Recuperar datos de salas de la base de datos.)</a>
</div>
</div>
</body>
</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