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" %> + + + + +
+ + + + + +