|
@ -7,9 +7,7 @@ import io.micrometer.common.util.StringUtils; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
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.PathVariable; |
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Controller |
|
|
@Controller |
|
@ -30,6 +28,11 @@ public class WebControlador { |
|
|
modelo.addAttribute("user",usuario); |
|
|
modelo.addAttribute("user",usuario); |
|
|
return "nuevo_usuario"; |
|
|
return "nuevo_usuario"; |
|
|
} |
|
|
} |
|
|
|
|
|
@PostMapping("/guardar") |
|
|
|
|
|
public String guardarUser (@ModelAttribute("user") User usuario) { |
|
|
|
|
|
servicioUser.registrar(usuario); |
|
|
|
|
|
return "redirect:/"; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@GetMapping ("/borrar") |
|
|
@GetMapping ("/borrar") |
|
|
public String borrarUser(Model modelo){ |
|
|
public String borrarUser(Model modelo){ |
|
|