diff --git a/src/main/java/es/fp/edu/conecta2/controladores/WebControlador.java b/src/main/java/es/fp/edu/conecta2/controladores/WebControlador.java index 404049a..ba5d0fb 100644 --- a/src/main/java/es/fp/edu/conecta2/controladores/WebControlador.java +++ b/src/main/java/es/fp/edu/conecta2/controladores/WebControlador.java @@ -2,17 +2,56 @@ package es.fp.edu.conecta2.controladores; import es.fp.edu.conecta2.repo.user.IUserRepo; import es.fp.edu.conecta2.servicios.UserService; +import io.micrometer.common.util.StringUtils; 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.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; @Controller public class WebControlador { @GetMapping ("/") - public String prueba() { - return "Esto es una prueba"; + public String inicio() { + + return "inicio"; + } + + @RequestMapping("parametros/{a}/{b}/{c}") + public String parametros( @PathVariable int a, + @PathVariable int b, + @PathVariable int c, + Model model) { + model.addAttribute("a",a); + model.addAttribute("b",b); + model.addAttribute("c",c); + return "parametros"; + } + @RequestMapping({"opcionales/{a}/{b}/{c}", + "opcionales/{a}/{b}", + "opcionales/{a}", + "opcionales"}) + public String opcionales( + @PathVariable (name = "a", required = false) String a, + @PathVariable (name = "b", required = false) String b, + @PathVariable (name = "c", required = false) String c, + Model model) { + if (StringUtils.isEmpty(a)) { + a = "0"; + } + if (StringUtils.isEmpty(b)) { + b = "0"; + } + if (StringUtils.isEmpty(c)) { + c = "0"; + } + model.addAttribute("a",a); + model.addAttribute("b",b); + model.addAttribute("c",c); + return "opcionales"; } @Autowired diff --git a/src/main/resources/templates/inicio.html b/src/main/resources/templates/inicio.html new file mode 100644 index 0000000..dde4132 --- /dev/null +++ b/src/main/resources/templates/inicio.html @@ -0,0 +1,11 @@ + + + + + Title + + +Hola mundo + + + \ No newline at end of file diff --git a/src/main/resources/templates/opcionales.html b/src/main/resources/templates/opcionales.html new file mode 100644 index 0000000..c6a2bb3 --- /dev/null +++ b/src/main/resources/templates/opcionales.html @@ -0,0 +1,13 @@ + + + + + Title + + +ParĂ¡metros opcionales: +

aaaaa

+

bbbb

+

cccc

+ + \ No newline at end of file diff --git a/src/main/resources/templates/parametros.html b/src/main/resources/templates/parametros.html new file mode 100644 index 0000000..d9ebcf5 --- /dev/null +++ b/src/main/resources/templates/parametros.html @@ -0,0 +1,13 @@ + + + + + + + +ParĂ¡metros: +

aaaaa

+

bbbb

+

cccc

+ + \ No newline at end of file