Question

I'm having a problem with firing an action with a p:commandButton when there's a p:fileUpload on my page: Here's the p:fileUpload

<p:fileUpload  auto="true" update="seqForm:sequence1"
allowTypes="/(\.|\/)(txt)$/"
fileUploadListener="#{fileUploadController.fileUploadListener1}" />

and the p:commandButton:

<p:commandButton id="submitButton" value="Submit!" 
action="#{submitAction.actionTest}"
update="seqForm:content"  />

When I add the fileUpload component to the page, its listener gets normally fired. However, the action of the commandButton doesn't work. If i remove the fileUpload from the page, the action from the button works fine.

Is it a bug or something I still haven't discovered? Thanks in advance.

Was it helpful?

Solution 2

I have fixed this issue using the following:

Link for the solution

I found this replacing the p:commandButton with h:commandButton. When I did it, the following error showed up:

The request content-type is not a multipart/form-data

Next I googled this and found the link above. Thanks anyway.

OTHER TIPS

Which PrimeFaces version and JSF implementation (with version) are you using? In the past there was an issue with form's enctype. Try newest version, or if it is not applicable for you, try to put the fileupload into different form

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top