Hi,
I'm adding support for file upload. I've added enctype="multipart/form-data" to a form tag and it's breaking update CRUD operation.
I've changed update.tagx from
toCode:<form:form action="${fn:escapeXml(form_url)}" method="PUT" modelAttribute="${modelAttribute}">
Now, When I'm trying to edit entitity with Roo generated form, it's causing hibernate unhandled exception, unable to persist detached object.Code:<form:form action="${fn:escapeXml(form_url)}" method="PUT" modelAttribute="${modelAttribute}" enctype="multipart/form-data" >
After debugging, I've discovered that instead of update method
create method is being called,Code:@RequestMapping(method = RequestMethod.PUT) public String TipLokacijeController.update(@Valid TipLokacije tipLokacije, BindingResult bindingResult, Model uiModel, HttpServletRequest httpServletRequest) { if (bindingResult.hasErrors()) { uiModel.addAttribute("tipLokacije", tipLokacije); return "tiplokacijes/update"; } uiModel.asMap().clear(); tipLokacije.merge(); return "redirect:/tiplokacijes/" + encodeUrlPathSegment(tipLokacije.getId().toString(), httpServletRequest); }
How can I add support for file upload without breaking "update" CRUD operationCode:@RequestMapping(method = RequestMethod.POST) public String TipLokacijeController.create(@Valid TipLokacije tipLokacije, BindingResult bindingResult, Model uiModel, HttpServletRequest httpServletRequest) { if (bindingResult.hasErrors()) { uiModel.addAttribute("tipLokacije", tipLokacije); return "tiplokacijes/create"; } uiModel.asMap().clear(); tipLokacije.persist(); return "redirect:/tiplokacijes/" + encodeUrlPathSegment(tipLokacije.getId().toString(), httpServletRequest); }
Thank you for your answers


Reply With Quote
