PDA

View Full Version : List of multipartfile problem



rascio
Dec 29th, 2010, 05:38 AM
Hi,
i've a problem with a list of multipartfile...
my bean has a List<MultipartFile> and in the jsp i populate this list with a spring:bind like this:


<spring:bind path="form.files">
<input type="file" name="${status.expression}" /><br/>
<input type="file" name="${status.expression}" /><br/>
<input type="file" name="${status.expression}" /><br/>
<input type="file" name="${status.expression}" /><br/>
</spring:bind>

but while for others properties the list made in this way works, for multipart the list contains only the first file...what can i do to solve this problem?

rascio
Dec 30th, 2010, 03:57 AM
This is the only solution that i've found to made this...


protected void bugMultipartFiles(DocumentForm documentForm, ActionRequest request){
if (documentForm != null){
logger.info("DocumentForm isn't null try to bind the multipart");
if (request instanceof MultipartRequest){
MultipartRequest multipartRequest = (MultipartRequest)request;
documentForm.setMultipartFiles(multipartRequest.ge tFiles("multipartFiles"));
logger.info("setted " + documentForm.getMultipartFiles().size() + " files");
}
else{
logger.warn("The request not contains a multipart, this can be an error");
}
}
else{
logger.info("DocumentForm is null");
}
}
I don't like this...i hope that there is another solution that i don't know...