I used Jquery file upload with backend java. Am getting
if(ServletFileUpload.isMultipartContent(request) is true.
but
List<FileItem> items = uploadHandler.parseRequest(request);
returns empty.I have not accessed request parameters before.
I google it and found change from /*
to /*.action
in web.xml will solve the problem. But by this change the struts2 project is not running.
That change makes no sense, both values (
*/
and/*.action
) are wrong, it should be/*
.You should never parse a Multipart Request by yourself, especially when there are tools out there like Apache Commons FileUpload doing it for you, most likely better than you. Quoting BalusC:
Struts2 already handles that. You only need to understand how the file upload process works in Struts2.
Try with a single file in an
<s:file/>
element first, then with multiple files in a<s:file/>
, and finally add Blueimp's jQuery-File-Upload to the equation.Notice that with external libraries, it might be necessary to make small modifications, like in the case of Dropzone.js (drag and drop uploader).