spring-mvc File Upload

30% OFF - 9th Anniversary discount on Entity Framework Extensions until December 15 with code: ZZZANNIVERSARY9



@RequestPartThis annotation specifies that a parameter should be mapped to a given request part. The part name must match the name of the method parameter, unless you choose to provide it as an argument to @RequestPart. If the part name is not expressible as a Java name (e.g. 123), then you can use the value attribute of the @RequestPart to specify the actual name. e.g. @RequestPart("123") String _123.


If you are running on an older version of Java (pre 1.7), or are compiling without debug information, then Java will replace the name of the parameter with arg0, arg1, etc, which will prevent Spring from being able to match them up with the part names. If that is the case, then you will need to set the name of the part in the @RequestPart annotation, as documented in Parameters.

Got any spring-mvc Question?