Advertisement
Guest User

Untitled

a guest
Mar 27th, 2019
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1.  
  2. ------- properties ------
  3.  
  4.  
  5.  
  6.  
  7.  
  8. spring.datasource.url=jdbc:postgresql://localhost/app
  9. spring.datasource.username=postgres
  10. spring.datasource.password=postgres
  11. spring.datasource.driver-class-name=org.postgresql.Driver
  12.  
  13. spring.jpa.database-platform=org.hibernate.dialect.PostgreSQL9Dialect
  14. spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults = false
  15. spring.jpa.show-sql = true
  16.  
  17. server.port= 8787
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24. --------------------------------- controller -----------------
  25.  
  26.  
  27.  
  28. public class EvcaControllers {
  29. @Autowired
  30. private EvcaRepository er;
  31.  
  32. private AgentRepository ar;
  33.  
  34. @Autowired
  35. private StticRepository sr;
  36.  
  37. @RequestMapping(value="/cadTester", method=RequestMethod.GET)
  38. public String form(){
  39. return "events/formEvca";
  40. }
  41.  
  42.  
  43. @RequestMapping(value="/cadTester", method=RequestMethod.POST)
  44. public String form(@Valid Evca evcEvents, BindingResult result, RedirectAttributes attributes){
  45. if(result.hasErrors()){
  46. attributes.addFlashAttribute("tester", "tester!");
  47. return "redirect:/cadastrarPesquisa";
  48. }
  49.  
  50.  
  51. er.save(evcEvents);
  52. attributes.addFlashAttribute("tester", "tester sucess!");
  53. return "redirect:/cadastrarPesquisa";
  54.  
  55. }
  56.  
  57. @RequestMapping("/eventss")
  58. public ModelAndView listEvents(){
  59. ModelAndView mv = new ModelAndView("index");
  60. Iterable<Evca> eventos = er.findAll();
  61. mv.addObject("evento", eventos);
  62. return mv;
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement