Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ------- properties ------
- spring.datasource.url=jdbc:postgresql://localhost/app
- spring.datasource.username=postgres
- spring.datasource.password=postgres
- spring.datasource.driver-class-name=org.postgresql.Driver
- spring.jpa.database-platform=org.hibernate.dialect.PostgreSQL9Dialect
- spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults = false
- spring.jpa.show-sql = true
- server.port= 8787
- --------------------------------- controller -----------------
- public class EvcaControllers {
- @Autowired
- private EvcaRepository er;
- private AgentRepository ar;
- @Autowired
- private StticRepository sr;
- @RequestMapping(value="/cadTester", method=RequestMethod.GET)
- public String form(){
- return "events/formEvca";
- }
- @RequestMapping(value="/cadTester", method=RequestMethod.POST)
- public String form(@Valid Evca evcEvents, BindingResult result, RedirectAttributes attributes){
- if(result.hasErrors()){
- attributes.addFlashAttribute("tester", "tester!");
- return "redirect:/cadastrarPesquisa";
- }
- er.save(evcEvents);
- attributes.addFlashAttribute("tester", "tester sucess!");
- return "redirect:/cadastrarPesquisa";
- }
- @RequestMapping("/eventss")
- public ModelAndView listEvents(){
- ModelAndView mv = new ModelAndView("index");
- Iterable<Evca> eventos = er.findAll();
- mv.addObject("evento", eventos);
- return mv;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement