Command not fired with multipart form (JSF 2.2)

Splash Forums PrettyFaces Users Command not fired with multipart form (JSF 2.2)

This topic contains 35 replies, has 8 voices, and was last updated by  biksg 6 years, 11 months ago.

Viewing 15 posts - 1 through 15 (of 36 total)
  • Author
  • #24826


    I’ve been trying to use the new h:inputFile from JSF 2.2, but I cannot get it to work. Ever since I have changed the “enctype” attribute of the “h:form” tag, the action is not being invoked anymore.

    After making some experiments, it looks like the problem is related to PrettyFaces.

    Here is what I am using:

    The pom.xml fragment:


    A pretty-config.xml example:

    <url-mapping id="how">
    	<pattern value="/como-funciona/" />
    	<view-id value="/how.jsf" />

    A link example:
    <h:link outcome="pretty:how" styleClass="featured-text-1">Como funciona</h:link>

    The form:
    <h:form id="idea-create-form" enctype="multipart/form-data">

    Any suggestions?

    • This topic was modified 8 years, 4 months ago by  rvcoutinho.
    • This topic was modified 8 years, 4 months ago by  rvcoutinho.
    • This topic was modified 8 years, 4 months ago by  rvcoutinho.

    Hmmm. That’s weird. I also use enctype="multipart/form-data" sometimes and everything works fine.

    Could you try to remove the mapping from the configuration and access the page directly via /how.jsf and check if it works in this case?




    Thanks for the response. I completely disabled PrettyFaces and Rewrite, and the problem still occurs. So, it is probably not related to PrettyFaces. I will keep digging.

    I appreciate your response anyway.



    Hi, Christian.

    There was a bug on the WildFly version at that time. But it has been fixed.

    The problem persists though.

    It looks like pretty faces might be messing with the multipart configuration of the new Servlet 3.1.

    Do you have any idea on how to solve it?

    Thanks in advance.

    • This reply was modified 7 years, 9 months ago by  rvcoutinho.
    • This reply was modified 7 years, 9 months ago by  rvcoutinho.

    I think I know what is causing this. The problem is that Rewrite calls HttpServletRequest.getParameter*() from a servlet filter which is not explicitly allowed for Servlet 3.1 multipart requests. For Tomcat there is a known workaround. But I’m not sure if there is a way in Wildfly to do something similar. Here are some references: (See “Why are file uploads not working correctly any more?”)




    I tried that before posting. I had no luck with the context.xml.

    Thank you anyway.


    Hmm, @Christian, do you think this is worth asking about on the WildFly mailing list? I’m not sure I see a great solution for this.


    Are we sure the problem is not due to the fact that we wrap the inbound request with our own, which might hide the fact that the request is actually a Multi-part request? I wonder if the servlet spec dictates how those requests need to be represented. Afaik it was non-standard, but I could be wrong.




    I have been debugging the rewrite lib for a while. But I have not been able to find the problem yet.

    Do you guys want a simple project in order to test it?

    Thank you.


    Here is my test app:

    After deploying to Wildfly, open this URL:


    Try uploading a file. This should work fine.

    The open UploadConfigProvider and add the Join to the configuration. Redeploy and open the following URL:


    The upload will not work any more.




    Thanks for the effort. Any suggestions?


    Unfortunately I didn’t find any time to have a deeper look at this issue. But this sample app may be a good starting point for debugging.


    Janario Oliveira


    I’m migrating a project to wildfly and I have the same problem.
    After some debugging I found in jsf-impl used in wildfly(2.2.5-jbossorg-3) a point that is evaluating different.

    The postback method doesn’t find the request parameter “javax.faces.ViewState” so it jumps from restoreView to renderResponse phase.

    After that I did some debugging in RewriteFilter.
    So evaluating request.getParameter(“javax.faces.ViewState”) in org.ocpsoft.rewrite.servlet.RewriteFilter.doFilter():155 looks like:

    – not multipart request with rewrite – show the parameter
    – multipart request without rewrite – show the parameter
    – multipart request with rewrite – parameter comes null

    Do you have any idea why this is happening?


    Could you give Rewrite 2.0.12.Final a try which was just released? It fixes some issues that caused problems with multipart requests on Wildfly. See


    Janario Oliveira

    Hi, I tried in 2.0.12.Final and also in 2.0.13.Final-SNAPSHOT. Same happens.

    It works with this workaround:

    1 – Add undertow-servlet as provided dependency:

                <version>1.0.0.Final</version><!--same version o wildfly-->

    2 – extends DefaultServlet from undertow and add @MultipartConfig

    @WebServlet(name = io.undertow.servlet.handlers.ServletPathMatches.DEFAULT_SERVLET_NAME, urlPatterns = "/*")
    public class MultipartDefaultServlet extends io.undertow.servlet.handlers.DefaultServlet { }

    After that the parameters will appears in the filter and also be able to invoke jsf actions.

    The problem is that WildFly associate a parser according to the servlet mapped

      io.undertow.server.handlers.form.FormEncodedDataDefinition always added
      io.undertow.server.handlers.form.MultiPartParserDefinition only added in multipart servlets, DefaultServlet doesn't handle multipart.

    If I map FacesServlet to same pattern of URLMapping FacesServlet will handle multipart.

    Trying to reproduce(without the workaround) I create a simple html(multipart.html) and try to see the parameters in a WebFilter

    <form enctype="multipart/form-data" method="post">
        <input name="testeParam" value="testeValue"/>
        <input type="submit"/>
    @WebFilter(urlPatterns = "/*")
    public class TestFilter implements Filter {

    The parameters are always empty. In JBoss same happens but when it is a request of a rewrite mapped(URLMapping) the parameters came in the filter.

    So, What do you think? Is it a bug in WildFly? but in basic sample(multipart.html) parameters are empty even in JBoss

Viewing 15 posts - 1 through 15 (of 36 total)

The forum ‘PrettyFaces Users’ is closed to new topics and replies.

Comments are closed.