The enctype="multipart/form-data" attribute is missing on the <h:form>. This is mandatory in order to be able to send files to the server.
The ExtensionsFilter is missing in web.xml or not properly mapped on the servlet name of the FacesServlet. This is mandatory in order to be able to parse the multipart/form-data request.
There is another filter in the request-response chain before the ExtensionsFilter which has already parsed the multipart/form-data request beforehand. For example, when you're using RichFaces4, such a filter will be auto-loaded without that you need to declare it in web.xml. Request bodies can be parsed only once, so the ExtensionsFilter would receive an empty request after such another filter.
There is another filter in the request-response chain before the ExtensionsFilter which has completely skipped the ExtensionsFilter by for example forwarding or redirecting the request.
发布评论
评论(1)
这可能有以下原因:
上缺少enctype="multipart/form-data"
属性。为了能够将文件发送到服务器,这是必需的。web.xml
中缺少ExtensionsFilter
,或者未正确映射到FacesServlet
的 servlet 名称。为了能够解析multipart/form-data
请求,这是必需的。请求-响应链中在
ExtensionsFilter
之前还有另一个过滤器,它已经预先解析了多部分/表单数据请求。例如,当您使用 RichFaces4 时,系统会自动加载此类过滤器,而无需您在web.xml
中声明它。请求正文只能解析一次,因此ExtensionsFilter
将在另一个过滤器之后收到一个空请求。请求-响应链中在
ExtensionsFilter
之前还有另一个过滤器,它完全跳过了ExtensionsFilter
,例如转发或重定向请求。That can have the following causes:
The
enctype="multipart/form-data"
attribute is missing on the<h:form>
. This is mandatory in order to be able to send files to the server.The
ExtensionsFilter
is missing inweb.xml
or not properly mapped on the servlet name of theFacesServlet
. This is mandatory in order to be able to parse themultipart/form-data
request.There is another filter in the request-response chain before the
ExtensionsFilter
which has already parsed the multipart/form-data request beforehand. For example, when you're using RichFaces4, such a filter will be auto-loaded without that you need to declare it inweb.xml
. Request bodies can be parsed only once, so theExtensionsFilter
would receive an empty request after such another filter.There is another filter in the request-response chain before the
ExtensionsFilter
which has completely skipped theExtensionsFilter
by for example forwarding or redirecting the request.