[ http://mc4j.org/jira/browse/STS-265?page=all ]
Philippe Laflamme updated STS-265:
----------------------------------
Attachment: fileupload-1.4.2.patch
Here's a patch against 1.4.2 to fix this limitation.
There's no way to implement this without breaking the current API. More
specifically, the MultipartWrapper interface needs to change and so does the
StripesRequestWrapper.
Here's a run down of the patch:
-- Stripes API and impl --
- MultipartWrapper: returns FileBean[] instead of FileBean
- CommonsMultipartWrapper: changed according to new MultipartWrapper
- CosMultipartWrapper now uses MultipartParser to allow multipe files for the
same parameter name
- StripesRequestWrapper: changed according to new MultipartWrapper
- DefaultActionBeanPropertyBinder: changed according to new interface and uses
bindNonNullValue to allow more advanced binding (arrays and List)
-- Tests --
- Created FileBeanBindingTests
- Created MockMultipartHttpServletRequest to allow adding Files to mock requests
- MockRoundtrip: added ability to use new MockMultipartHttpServletRequest
- StripesTestFixture: added ability to a pass configuration parameters (allows
using Cos or commons-fileupload).
> Support for multiple file uploads with the same parameter name in one request
> -----------------------------------------------------------------------------
>
> Key: STS-265
> URL: http://mc4j.org/jira/browse/STS-265
> Project: Stripes
> Issue Type: Improvement
> Components: ActionBean Dispatching
> Affects Versions: Release 1.4
> Reporter: Tim Fennell
> Assigned To: Tim Fennell
> Fix For: Release 1.5
>
> Attachments: fileupload-1.4.2.patch
>
>
> From Gregg Bolinger on the user list:
> I am building a page for the user to upload up to 5 images at the same time.
> Initially, I had a property for each FileBean in the action bean. imageFile1,
> imageFile2, etc. with getters and setters for each. The problem is it's
> quite a pain, and a lot of code, to check each one to make sure there is an
> image file and then process the file. So I tried doing something like this:
> <stripes:file name="imageFiles"/>
> <stripes:file name="imageFiles"/>
> <stripes:file name="imageFiles"/>
> <stripes:file name="imageFiles"/>
> <stripes:file name="imageFiles"/>
> private FileBean[] imageFiles;
> public FileBean[] getImageFiles()
> {
> return imageFiles;
> }
> public void setImageFiles(FileBean[] imageFiles)
> {
> this.imageFiles = imageFiles;
> }
> However, this did not seem to work. What I would really prefer is something
> like this:
> <stripes:file name="imageFile"/>
> <stripes:file name="imageFile"/>
> <stripes:file name="imageFile"/>
> <stripes:file name="imageFile"/>
> <stripes:file name="imageFile"/>
> private List<FileBean> imageFiles;
> // getters and setters
> and then in my action I can do:
> for (FileBean fb : imageFiles)
> {
> // do all the cool stuff
> }
> Is there any way to do this currently?
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://mc4j.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development