Commit 2d519b30 by Nelson Ruiz

Se hizo post de postulantes

parent b5170879
{
"configurations": [
{
"type": "java",
"name": "Spring Boot-CurriculumsearchApplication<curriculumsearch>",
"request": "launch",
"cwd": "${workspaceFolder}",
"console": "internalConsole",
"mainClass": "com.roshka.CurriculumsearchApplication",
"projectName": "curriculumsearch",
"args": ""
}
]
}
\ No newline at end of file
...@@ -41,6 +41,12 @@ ...@@ -41,6 +41,12 @@
<artifactId>tomcat-jasper</artifactId> <artifactId>tomcat-jasper</artifactId>
<version>9.0.54</version> <version>9.0.54</version>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
package com.roshka.controller;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.servlet.http.HttpServletRequest;
import com.roshka.modelo.Postulante;
import com.roshka.repositorio.PostulanteRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpRequest;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@Controller
public class PostulanteController {
@Autowired
PostulanteRepository post;
@RequestMapping("/")
public String index(){
return "home";
}
@PostMapping("/")
public String guardarPostulante( @RequestParam String nombre,@RequestParam String apellido, @RequestParam
String ci,@RequestParam String correo,@RequestParam String ciudad,@RequestParam String telefono,
@RequestParam String fechaNacimiento,@RequestParam String resumen,@RequestParam long nivelIngles,
@RequestParam String curriculum, @RequestParam String modalidad,@RequestParam String disponibilidad ){
try {
Date date1=new SimpleDateFormat("yyyy-mm-dd").parse(fechaNacimiento);
Postulante postulante= new Postulante(nombre, apellido, ci, correo, ciudad,
telefono,date1, resumen,
nivelIngles, curriculum, modalidad, disponibilidad);
post.save(postulante);
} catch (Exception e) {
//TODO: handle exception
System.out.println(e);
}
System.out.println( fechaNacimiento);
return "dfg";
}
}
...@@ -8,6 +8,24 @@ import java.util.List; ...@@ -8,6 +8,24 @@ import java.util.List;
@Entity @Entity
@Table(name="postulante") @Table(name="postulante")
public class Postulante { public class Postulante {
public Postulante(String nombre, String apellido, String ci, String correo, String ciudad, String telefono,
Date fechaNacimiento, String resumen, long nivelIngles, String curriculum, String modalidad,
String disponibilidad) {
this.nombre = nombre;
this.apellido = apellido;
this.ci = ci;
this.correo = correo;
this.ciudad = ciudad;
this.telefono = telefono;
this.fechaNacimiento = fechaNacimiento;
this.resumen = resumen;
this.nivelIngles = nivelIngles;
this.curriculum = curriculum;
this.modalidad = modalidad;
this.disponibilidad = disponibilidad;
}
@Id @Id
@GeneratedValue(strategy = GenerationType.AUTO) @GeneratedValue(strategy = GenerationType.AUTO)
@Column(name="id") @Column(name="id")
...@@ -49,13 +67,13 @@ public class Postulante { ...@@ -49,13 +67,13 @@ public class Postulante {
@Column(name = "disponibilidad") @Column(name = "disponibilidad")
private String disponibilidad; private String disponibilidad;
@OneToMany(mappedBy = "postulante") @OneToMany(mappedBy = "postulante",cascade = CascadeType.ALL)
private List<PostulanteTecnologia> tecnologias; private List<PostulanteTecnologia> tecnologias;
@OneToMany(mappedBy = "postulante") @OneToMany(mappedBy = "postulante",cascade = CascadeType.ALL)
private List<Experiencia> experiencias; private List<Experiencia> experiencias;
@OneToMany(mappedBy = "postulante") @OneToMany(mappedBy = "postulante",cascade = CascadeType.ALL)
private List<Estudio> estudios; private List<Estudio> estudios;
public long getId() { public long getId() {
......
...@@ -11,7 +11,5 @@ spring.sql.init.platform=postgres ...@@ -11,7 +11,5 @@ spring.sql.init.platform=postgres
spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true
#server.port=8888 #server.port=8888
spring.mvc.view.prefix=/WEB-INF/views/ spring.mvc.view.prefix=/jsp/
spring.mvc.view.suffix=.jsp spring.mvc.view.suffix=.jsp
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<title>Hello, world!</title>
</head>
<body>
<h1>Hello, world!</h1>
<form name="postulante" method="post">
<div class="mb-3 col-5">
<label for="correo" class="form-label">Email address</label>
<input type="email" name="correo" class="form-control " id="correo" aria-describedby="emailHelp">
<div id="emailHelp" class="form-text">We'll never share your email with anyone else.</div>
</div>
<div class="mb-3 col-5">
<label for="nombre" class="form-label">Nombre</label>
<input type="text" name="nombre" class="form-control " id="nombre" aria-describedby="emailHelp">
</div>
<div class="mb-3 col-5">
<label for="apellido" class="form-label">Apellido</label>
<input type="text" name="apellido" class="form-control " id="apellido" aria-describedby="emailHelp">
</div>
<div class="mb-3 col-3">
<label for="ci" class="form-label">Cedula de identidad</label>
<input type="number" name="ci" class="form-control " id="ci" aria-describedby="emailHelp">
</div>
<div class="mb-3 col-5">
<label for="ciudad" class="form-label">Ciudad</label>
<input type="text" name="ciudad" class="form-control " id="ciudad" aria-describedby="emailHelp">
</div>
<div class="mb-3 col-5">
<label for="telefono" class="form-label">Telefono</label>
<input type="number" name="telefono" class="form-control " id="telefono" aria-describedby="emailHelp">
</div>
<div class="mb-3 col-5">
<label for="fechaNacimiento" class="form-label">Fecha de nacimiento</label>
<input type="date" name="fechaNacimiento" class="form-control " id="fechaNacimiento" aria-describedby="emailHelp">
</div>
<div class="mb-3 col-5">
<label for="resumen" class="form-label">Resumen</label>
<textarea class="form-control " name="resumen" id="resumen" aria-describedby="emailHelp"> </textarea>
</div>
<div class="mb-3 col-5">
<label for="nivelIngles" class="form-label">Nivel de ingles</label>
<input type="text" class="form-control" name="nivelIngles" id="nivelIngles" aria-describedby="emailHelp">
</div>
<div class="mb-3 col-5">
<label for="curriculum" class="form-label">Curriculum</label>
<input type="text" name="curriculum" class="form-control " id="curriculum" aria-describedby="emailHelp">
</div>
<div class="mb-3 col-5">
<label for="disponibilidad" class="form-label">Disponibilidad</label>
<input type="text" class="form-control " name="disponibilidad" id="disponibilidad" aria-describedby="emailHelp">
</div>
<div class="mb-3 col-5">
<label for="modalidad" class="form-label">Modalidad</label>
<input type="text" class="form-control " name="modalidad" id="modalidad" aria-describedby="emailHelp">
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
<!-- Optional JavaScript; choose one of the two! -->
<!-- Option 1: Bootstrap Bundle with Popper -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
<!-- Option 2: Separate Popper and Bootstrap JS -->
<!--
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.10.2/dist/umd/popper.min.js" integrity="sha384-7+zCNj/IqJ95wo16oMtfsKbZ9ccEh31eOz1HGyDuCQ6wgnyJNSYdrPa03rtR1zdB" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.min.js" integrity="sha384-QJHtvGhmr9XOIpI6YVutG+2QOK9T+ZnN4kzFN1RtK3zEFEIsxhlmWl5/YESvpZ13" crossorigin="anonymous"></script>
-->
</body>
</html>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment