My controller looks like this:
@PostMapping("/event/{id}")
public String save(@PathVariable("id") long id, @Valid Form form, BindingResult bindingResult ) {
if (!bindingResult.hasErrors()) {
//No errors
//No return
}
return "redirect:/event/{id}";
}
My @GetMapping is:
@GetMapping("/event/{id}")
public ModelAndView eventDetail(@PathVariable("id") long id) {
ModelAndView model = new ModelAndView("event/details");
Event event = eventoRepository.findById(id).get();
model.addObject("event", evento);
model.addObject("guests", event.getGuests());
model.addObject("guest",new Guest());
return model;
}
I know that "${#fields.hasErrors('*')}" is always false because redirect. (right?)
How return to this path /event/{id}
without redirect?