Does p:fileUpload work with PrimeFaces Mobile (PFM)?

UI Components for JSF
Post Reply
RElliott
Posts: 94
Joined: 07 Feb 2014, 00:39

16 Feb 2015, 08:16

When I insert the following form in my standard PrimeFaces template, I am able to upload files:

Code: Select all

<h:form enctype="multipart/form-data">
    <p:fileUpload
        value="#{fileUpload.file}"
        mode="simple" />
    <p:commandButton
        value="Submit"
        ajax="false"
        actionListener="#{fileUpload.upload}" />
</h:form>
When I insert the above code in my PrimeFaces Mobile template, I receive at null pointer exception when I access the file variable in my fileUpload backing bean.
PrimeFaces 7.0.1, Glassfish 5.1.0, Oracle JDK 8, Eclipse 2016-02

RElliott
Posts: 94
Joined: 07 Feb 2014, 00:39

17 Feb 2015, 00:08

I just noticed that liukvar asked same question a few days ago when he asked
Unexpected error using fileUpload component
.

http://forum.primefaces.org/viewtopic.php?f=8&t=40658
PrimeFaces 7.0.1, Glassfish 5.1.0, Oracle JDK 8, Eclipse 2016-02

RElliott
Posts: 94
Joined: 07 Feb 2014, 00:39

17 Feb 2015, 19:35

I resolved my issues by switching to the <h:inputFile> tag as as shown below:

Code: Select all

<h:inputFile
    id="file"
    value="#{fileUpload.file}"
    required="true"
    requiredMessage="File is required."
    label="File" />
<p:commandButton
        value="Submit"
        ajax="false"
        action="#{fileUpload.upload}" />
See the following tutorial for details: http://www.javatutorials.co.in/jsf-2-2- ... inputfile/.
PrimeFaces 7.0.1, Glassfish 5.1.0, Oracle JDK 8, Eclipse 2016-02

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 40 guests