MultiPart Form error passing to view
I'm new to spring and i'm currently trying to create a file upload mechanism.
I've read the documentation regarding file upload (using MultipartResolver), and the documentation regarding validation, but I can't put the two pieces together.
Here's what i'd like to have :
Code:
@RequestMapping(method = RequestMethod.POST)
public String handleFormUpload( @RequestParam("file") MultipartFile file , @RequestParam("name") String name, Errors validationErrors)
This throws a
Code:
An Errors/BindingResult argument is expected to be immediately after the model attribute argument in the controller method signature
So, i've tried adding all kind of things from Model to Object right before the "Errors" parameter without any luck.
Basically what i'd like is to write an error back in my form if anything is wrong with the file using
Code:
<form:errors path="file" cssClass="errors"/>