Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6858347
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:08:49+00:00 2026-05-27T02:08:49+00:00

I have problem uploading with primefaces upload widget. After some investigation I noticed that

  • 0

I have problem uploading with primefaces upload widget. After some investigation I noticed that it is sending wrong post type “url-data-encoded” as opposed to multi-patrt request. Even though my form clearly declares it :

p:dialog name= "upload" id="mapping" header="Upload Mapping File" widgetVar="mappingFileDialog" fixedCenter="true">
     <h:form prependId="true" id="uploadMapping" enctype="multipart/form-data">
                    <p:fileUpload value="#{panaceaController.file}" mode="simple"/>
                    <p:commandButton id="uploadbuttom" value="Submit" ajax="true" 
            action="#{panaceaController.handleFileUpload}"/>
     </h:form>
    </p:dialog>

What happens is that the file field in the controller is null.
Other thing that I guess is related is that I have multiple forms in this page, I guess primefaces submits the wrong form.

BTW if I disable ajax for the upload form, the request enctype is correct, but it doesn’t invoke the action anymore?!

This is my html form:

<h:form prependId="false">
    <p:dataTable id="instances" lazy="false" paginator="false" var="instance"
                 value="#{panaceaController.instances}">
        <p:column>
            <f:facet name="header">
                <h:outputText value="Name"/>
            </f:facet>
                <h:outputText value="#{instance.name}"/>
        </p:column>
        <p:column>
            <f:facet name="header">
                <h:outputText value="Directory"/>
            </f:facet>
            <h:outputText value="#{instance.directory}"/>
        </p:column>
        <p:column>
            <f:facet name="header">
                Options
            </f:facet>
            <p:commandLink async="true" update="propertiesTable" oncomplete="propertiesDialog.show();">
                <h:graphicImage value="img/properties.png" />
                <f:setPropertyActionListener value="#{instance}" target="#{panaceaController.instance}"/>
            </p:commandLink>

            <p:commandLink async="true"  onclick="confirmDelete.show();" >
                <h:graphicImage value="img/edit-delete.png"/>
                <f:setPropertyActionListener value="#{instance}" target="#{panaceaController.instance}"/>
            </p:commandLink>
            <p:commandLink async="true"  onclick="mappingFileDialog.show();" >
                <h:graphicImage value="img/mapping.png"/>
                <f:setPropertyActionListener value="#{instance}" target="#{panaceaController.instance}"/>
            </p:commandLink>

        </p:column>

    </p:dataTable>
</h:form>
<p:dialog id="properties" header="Properties"  widgetVar="propertiesDialog" fixedCenter="true">
    <h:panelGroup id="propertiesTable" >
        <p>
        Properties for #{panaceaController.instance.directory} :
        </p>
    <h:form>
    <p:dataTable id="propertyTable" var="propertyInstance" value="#{panaceaController.instance.properties}" paginator="false">
        <p:column>
            <h:outputText value="#{propertyInstance.name}"/>
        </p:column>
        <p:column>
            <h:inputText value = "#{propertyInstance.value}" required="true"/>
        </p:column>
    </p:dataTable>
        <h:commandButton action="#{panaceaController.saveProperties}" value="Save"/>
    </h:form>
    </h:panelGroup>
</p:dialog>
<h:form>
<p:confirmDialog widgetVar="confirmDelete" message="Are you sure you want to delete this Panacea instance?"
                                         severity="warn">
      <p:commandButton value="Yes" update="instances" oncomplete="confirmDelete.hide()"
            actionListener="#{panaceaController.delete}"  />
      <p:commandButton value="Not" onclick="confirmDelete.hide()" type="button"  />
</p:confirmDialog>
</h:form>
<p:dialog name= "upload" id="mapping" header="Upload Mapping File" widgetVar="mappingFileDialog" fixedCenter="true">
 <h:form prependId="true" id="uploadMapping" enctype="multipart/form-data">
                <p:fileUpload value="#{panaceaController.file}" mode="simple"/>
                <p:commandButton id="uploadbuttom" value="Submit" ajax="false" async="false"
        action="#{panaceaController.handleFileUpload}"/>
 </h:form>
</p:dialog>

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T02:08:49+00:00Added an answer on May 27, 2026 at 2:08 am

    I don’t have any filter set up in the web.xml

    You need to configure the PrimeFaces file upload filter in web.xml as per the PrimeFaces User Guide. Here’s an extract of page 170 of the User Guide for 3.0.M4:

    3.34 FileUpload

    …

    Getting started with FileUpload

    First thing to do is to configure the fileupload filter which parses the multipart request. FileUpload filter should map to Faces Servlet.

    <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>
    </filter-mapping>
    

    The same applies as good for older beta versions like M1 as you have.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have problem in some JavaScript that I am writing where the Switch statement
I have a simple PHP upload page that when finished uploading runs a bit
I have problem with uploading image to SQL database. i have Methods Upload in
I have problem compilin this code..can anyone tell whats wrong with the syntax CREATE
I have problem when I try insert some data to Informix TEXT column via
I have problem with fancybox. I want to write a function that will run
all. I have a problem with uploading of the file in Silverlight application. Here
I am using Cakephp as my framework. I have a problem in uploading my
I have a .NET 3.5 website that is uploading files to a SQL Server
After uploading and resizing this photo, i noticed the quality of it become slightly

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.