@RequestMapping(value = FILE_UPLOAD, method = RequestMethod.POST)
@RequireHardLogIn
public ResponseEntity<String> uploadFileHandler(final Model model, @ModelAttribute("importCSVSavedCartForm")
final ImportCSVSavedCartForm importCSVSavedCartForm, final BindingResult bindingResult)
{
customFileValidator.validate(importCSVSavedCartForm, bindingResult);
if (bindingResult.hasErrors())
{
final String errorMessage = getMessageSource().getMessage(bindingResult.getAllErrors().get(0).getCode(), null,
getI18nService().getCurrentLocale());
return new ResponseEntity<String>(errorMessage, HttpStatus.BAD_REQUEST);
}
Asked
Active
Viewed 82 times
0

David Buck
- 3,752
- 35
- 31
- 35

chandu Chanddana
- 1
- 1
-
try this @PostMapping("/File_UPLOAD") – Nafaz M N M Jul 24 '20 at 17:08
-
@NafazBenzema - It doesn't matter with [Spring MVC](https://stackoverflow.com/questions/12742695/use-or-not-leading-slash-in-value-for-requestmapping-need-official-docs-or-poi). – Arvind Kumar Avinash Jul 24 '20 at 17:59
-
@ArvindKumarAvanish yes, I thought that. but his question is not clear – Nafaz M N M Jul 24 '20 at 19:44
-
As you are returning a body you must add the annotation `@ResponseBody`. What is your postman/curl call that you are using to hit this method? – Farrukh Chishti Jul 28 '20 at 22:45