How can I handle multipart/form-data POST requests in my java servlet?

假装没事ソ 提交于 2019-11-28 01:58:00
Andrzej Doyle

Check out Apache Commons Fileupload. It gives you a programmatic API to parse a multipart request, and iterate through the parts of it individually.

I've used it in the past for straightforward multipart processing and it does the job fine without being overly complicated.

Tomcat 6 does not and will not support Servlet Specification 3.0. You should attempt doing this on Tomcat 7, but I'm not really sure whether this functionality is present in the beta release that is currently available. The functionality is expected to be present in the production release though.

You could continue using Apache Commons FileUpload like posted in the other answer, or you could use Glassfish (depending on the current phase and type of your project).

Divyesh Rupawala

when we used post method than data are encrypted so we have to used servletfileupload to get requested data and using FileItemIterator we can get all form data.

i already answer on this link How to process a form sent Google Web Toolkit in a servlet

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!