Primefaces FileUpload with PrettyFaces and JSF 2.2.3

后端 未结 3 862
渐次进展
渐次进展 2020-12-01 19:29

I\'m having some problems with PrettyFaces on the pages I use .

When I disable the PrettyFaces filter on the page, everything works

相关标签:
3条回答
  • 2020-12-01 20:11

    Use in web.xml

    <filter>  
        <filter-name>PrimeFaces FileUpload Filter</filter-name>
        <filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class>
    </filter>
    
    <filter-mapping>
        <filter-name>PrimeFaces FileUpload Filter</filter-name>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.jsf</url-pattern> 
    </filter-mapping>
    
    0 讨论(0)
  • 2020-12-01 20:13

    It does not work very well. Works with upload small files. If the file is a few MB he can not invoke the method. I do not advise using Primefaces + prettyfaces.

    If your case is upload small files can work. Remove the primefaces fileupload configuration of web.xml and create the context.xml file as mentioned above.

    I did with 'rewrite-servlet-2.0.9.Final.jar'. It worked perfectly with upload small files.

    0 讨论(0)
  • 2020-12-01 20:19

    I've found the solution.

    Create the context.xml in the META-INF folder and put this code:

    <?xml version="1.0" encoding="UTF-8"?>
    <Context allowCasualMultipartParsing="true">
    </Context>
    

    You can remove the Fileupload Filter from web.xml

    Where I found the solution: http://ocpsoft.org/rewrite/docs/faq

    And that's why you need to put it: How to use HttpServletRequest#getParts() in a servlet filter running on Tomcat?

    If your problem is the size of the file, take a look at: <p:fileUpload> limiting to 2 Mb

    0 讨论(0)
提交回复
热议问题