From b18ad9e926553dc45fae5659f374809546baaa8f Mon Sep 17 00:00:00 2001 From: Joel Date: Mon, 15 Nov 2021 13:37:42 -0300 Subject: [PATCH] home controller --- curriculumsearch/src/main/java/com/roshka/controller/HomeController.java | 13 +++++++++++++ curriculumsearch/src/main/java/com/roshka/controller/PostulanteController.java | 69 +++++++++++++++++++++++++++++++-------------------------------------- curriculumsearch/src/main/webapp/jsp/cargo-form.jsp | 10 +++++----- 3 files changed, 49 insertions(+), 43 deletions(-) create mode 100644 curriculumsearch/src/main/java/com/roshka/controller/HomeController.java diff --git a/curriculumsearch/src/main/java/com/roshka/controller/HomeController.java b/curriculumsearch/src/main/java/com/roshka/controller/HomeController.java new file mode 100644 index 0000000..360d3af --- /dev/null +++ b/curriculumsearch/src/main/java/com/roshka/controller/HomeController.java @@ -0,0 +1,13 @@ +package com.roshka.controller; + +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.RequestMapping; +@Controller +@RequestMapping("/home") +public class HomeController { + @RequestMapping() + public String home(Model model) { + return "index"; + } +} diff --git a/curriculumsearch/src/main/java/com/roshka/controller/PostulanteController.java b/curriculumsearch/src/main/java/com/roshka/controller/PostulanteController.java index 8182d80..547dac9 100644 --- a/curriculumsearch/src/main/java/com/roshka/controller/PostulanteController.java +++ b/curriculumsearch/src/main/java/com/roshka/controller/PostulanteController.java @@ -81,13 +81,6 @@ public class PostulanteController { this.carRepo=carRepo; } - @RequestMapping("home") - public String index() { - - - return "index"; - } - @RequestMapping("/postulantes") public String postulantes(Model model, @RequestParam(required = false)Long tecId, @@ -182,8 +175,8 @@ public class PostulanteController { return "redirect:/postulacion-correcta"; } - @GetMapping("/postulacion-correcta") - public String successPostulation(Model model){ + @GetMapping("/postulacion-correcta") + public String successPostulation(Model model){ model.addAttribute("mensaje1", "Tu informacion se ha recibido correctamente!"); model.addAttribute("mensaje2", " espera por que nos pongamos en contacto!"); return "exitoRegistro"; @@ -197,33 +190,33 @@ public class PostulanteController { .body(ex.getMessage()); } - @ResponseStatus(HttpStatus.BAD_REQUEST) - @ExceptionHandler({ConstraintViolationException.class}) - public ResponseEntity handleValidationExceptions2( - ConstraintViolationException ex) { - return ResponseEntity.status(HttpStatus.BAD_REQUEST) - .body(ex.getMessage()); - } - - - - @GetMapping({"/postulante/{postulanteId}"}) - public String getPostulanteDetalle(Model model, @PathVariable("postulanteId") Long postulanteId) { - Postulante p = post.findById(postulanteId).orElse(null); - model.addAttribute("postulante",p); - model.addAttribute("estadoP", EstadoPostulante.values()); - return "detallepostulante"; - - } - @PostMapping({"/postulante/{postulanteId}"}) - public String setPostulanteEstado(@ModelAttribute Postulante postulante, BindingResult result, @PathVariable("postulanteId") Long postulanteId) { - //post.setPostulanteEstadoAndComentario(postulante.getEstadoPostulante(),postulante.getComentarioRRHH(), postulante.getId()); - Postulante postulanteVd = post.getById(postulanteId); - postulanteVd.setEstadoPostulante(postulante.getEstadoPostulante()); - postulanteVd.setComentarioRRHH(postulante.getComentarioRRHH()); - post.setPostulanteEstadoAndComentario(postulante.getEstadoPostulante(), postulante.getComentarioRRHH(), postulanteId); - //post.save(postulanteVd); - return "redirect:/postulante/"+postulanteId; - } - } + @ResponseStatus(HttpStatus.BAD_REQUEST) + @ExceptionHandler({ConstraintViolationException.class}) + public ResponseEntity handleValidationExceptions2( + ConstraintViolationException ex) { + return ResponseEntity.status(HttpStatus.BAD_REQUEST) + .body(ex.getMessage()); + } + + + + @GetMapping({"/postulante/{postulanteId}"}) + public String getPostulanteDetalle(Model model, @PathVariable("postulanteId") Long postulanteId) { + Postulante p = post.findById(postulanteId).orElse(null); + model.addAttribute("postulante",p); + model.addAttribute("estadoP", EstadoPostulante.values()); + return "detallepostulante"; + + } + @PostMapping({"/postulante/{postulanteId}"}) + public String setPostulanteEstado(@ModelAttribute Postulante postulante, BindingResult result, @PathVariable("postulanteId") Long postulanteId) { + //post.setPostulanteEstadoAndComentario(postulante.getEstadoPostulante(),postulante.getComentarioRRHH(), postulante.getId()); + Postulante postulanteVd = post.getById(postulanteId); + postulanteVd.setEstadoPostulante(postulante.getEstadoPostulante()); + postulanteVd.setComentarioRRHH(postulante.getComentarioRRHH()); + post.setPostulanteEstadoAndComentario(postulante.getEstadoPostulante(), postulante.getComentarioRRHH(), postulanteId); + //post.save(postulanteVd); + return "redirect:/postulante/"+postulanteId; + } +} \ No newline at end of file diff --git a/curriculumsearch/src/main/webapp/jsp/cargo-form.jsp b/curriculumsearch/src/main/webapp/jsp/cargo-form.jsp index ca2da8d..1b88d76 100644 --- a/curriculumsearch/src/main/webapp/jsp/cargo-form.jsp +++ b/curriculumsearch/src/main/webapp/jsp/cargo-form.jsp @@ -24,15 +24,15 @@ contentType="text/html;charset=UTF-8" language="java" %>
-

Agregar Cargo

-
+
+
${cargo.id == null ? "Agregar" : "Modificar"} Cargo
-
+
Nombre del cargo @@ -44,7 +44,7 @@ contentType="text/html;charset=UTF-8" language="java" %> />
-
+
-- libgit2 0.26.0