pon., 26 lut 2024 o 12:08 Greg Huber <gregh3...@gmail.com> napisał(a):
>
> The documentation only lists one file
>
> |public void withUploadedFiles(List<UploadedFile> uploadedFiles) { if
> (!uploadedFiles.isEmpty()) { this.uploadedFile = uploadedFiles.get(0);
> this.fileName = uploadedFile.getName(); this.contentType =
> uploadedFile.getContentType(); this.originalName =
> uploadedFile.getOriginalName(); } }|
>
> For multiple files these need populating
>
> privateFile[]uploadedFiles=null;
>
> privateString[]uploadedFilesContentType=null;
>
> privateString[]uploadedFilesFileName=null;
>
> We have to loop and do it ourselves now?

Basically it would be better to stop using additional fields if not
needed. You can achieve the same behaviour just exposing getters
extracting what's needed from "uploadedFiles", eg:

public void withUploadedFiles(List<UploadedFile> uploadedFiles) {
  this.uploadedFiles = uploadedFiles;
}

public String[] getUploadedFilesContentType() {
  return 
this.uploadedFiles.stream().map(UploadedFile::getContentType).toArray();
}

etc.


Cheers
Lukasz

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@struts.apache.org
For additional commands, e-mail: dev-h...@struts.apache.org

Reply via email to