From 5217c61a68c7495b70a32cefc77973c74aedb676 Mon Sep 17 00:00:00 2001 From: Javier Ferreira Date: Fri, 5 Nov 2021 16:18:39 -0300 Subject: [PATCH] form para agregar tecnologias nuevas --- curriculumsearch/src/main/java/com/roshka/controller/TecnologiaController.java | 41 +++++++++++++++++++++++++++++++++++++++++ curriculumsearch/src/main/java/com/roshka/modelo/Tecnologia.java | 2 +- curriculumsearch/src/main/webapp/jsp/tecnologia-form.jsp | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 curriculumsearch/src/main/java/com/roshka/controller/TecnologiaController.java create mode 100644 curriculumsearch/src/main/webapp/jsp/tecnologia-form.jsp diff --git a/curriculumsearch/src/main/java/com/roshka/controller/TecnologiaController.java b/curriculumsearch/src/main/java/com/roshka/controller/TecnologiaController.java new file mode 100644 index 0000000..11dc881 --- /dev/null +++ b/curriculumsearch/src/main/java/com/roshka/controller/TecnologiaController.java @@ -0,0 +1,41 @@ +package com.roshka.controller; + +import com.roshka.modelo.Tecnologia; +import com.roshka.repositorio.TecnologiaRepository; + +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.ModelAttribute; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; + +@Controller +public class TecnologiaController { + + TecnologiaRepository tecRepo; + + +@Autowired +public TecnologiaController(TecnologiaRepository tecRepo){ + this.tecRepo = tecRepo; + +} + +@GetMapping("/tecnologia") +public String addtecnologiaView(Model model) { + model.addAttribute("tecnologia", new Tecnologia()); + return "tecnologia-form"; +} +@PostMapping("/tecnologia") + public String addtecnologia(@ModelAttribute("tecnologia") Tecnologia tecnologia) { + tecRepo.save(tecnologia); + + return "redirect:/"; + } + + + + +} diff --git a/curriculumsearch/src/main/java/com/roshka/modelo/Tecnologia.java b/curriculumsearch/src/main/java/com/roshka/modelo/Tecnologia.java index 67b85ff..4101a0d 100644 --- a/curriculumsearch/src/main/java/com/roshka/modelo/Tecnologia.java +++ b/curriculumsearch/src/main/java/com/roshka/modelo/Tecnologia.java @@ -29,7 +29,7 @@ public class Tecnologia { this.id = id; } public String getNombre() { - return nombre.toLowerCase(); + return nombre; } public void setNombre(String nombre) { this.nombre = nombre; diff --git a/curriculumsearch/src/main/webapp/jsp/tecnologia-form.jsp b/curriculumsearch/src/main/webapp/jsp/tecnologia-form.jsp new file mode 100644 index 0000000..cb244c0 --- /dev/null +++ b/curriculumsearch/src/main/webapp/jsp/tecnologia-form.jsp @@ -0,0 +1,39 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> +<%@ page contentType="text/html;charset=UTF-8" language="java" %> + + + + + + + + + + + Hello, world! + + + + + + + + + + name: + + + + + + + + + + + + \ No newline at end of file -- libgit2 0.26.0