Request.getParts is called without multiparameter configuration. Either add @MultipartConfig to the servlet or the multipart-config element to web.xml

I would like to use a component component to load JSF files. With AJAX if possible. But I cannot get it to work.

FileUpload

<h:form enctype="multipart/form-data">
    <h:inputFile value="#{bean.file}" required="true"/>
    <h:commandButton action="#{bean.importFile()}"/>
</h:form>

      

I thought the following error should not be present when using JSF 2.2.

Request.getParts

called without multiparameter configuration. Either add a @MultipartConfig

for servlet or multipart-config element for web.xml

Environment

  • Glassfish 4.1
  • Mojarra 2.2.4
  • Primefaces 5.0
+3


source to share


1 answer


For some [incomprehensible] reason, @MultipartConfig

which was added in FacesServlet

for JSF-2.2 is not used for you. As a result, you now need to manually add the multipart configuration to your web.xml like so:



 <multipart-config>
      <location>/tmp</location>
      <max-file-size>20848820</max-file-size>
      <max-request-size>418018841</max-request-size>
      <file-size-threshold>1048576</file-size-threshold>
 </multipart-config>

      

+3


source







All Articles