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

  • SEARCH
  • Home
  • 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 1053155
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T17:12:31+00:00 2026-05-16T17:12:31+00:00

I will try to be as brief as possible, please stay with me here

  • 0

I will try to be as brief as possible, please stay with me here

“A.jsf” -> managed bean : bean
“#{bean.list}”: will take us to B.jsf

        <p:growl id="msgs" showDetail="true"/>
        <h:form id="myform1" enctype="multipart/form-data">
            <p:panel header="Upload" style="font-size: 11px;">
                <h:panelGrid columns="2" cellpadding="10">
                    <h:outputLabel value="Drawing:" />
                    <p:fileUpload fileUploadListener="#{bean.handleFileUpload}" update="msgs" allowTypes="*.*;"/>                        
                </h:panelGrid>
                <p:commandButton ajax="false" immediate="true" id="back" value="Back" action="#{bean.list}"/>
                <p:commandButton ajax="false" id="persist" value="Persist" action="#{bean.handleRevision}" />
            </p:panel>
        </h:form>

Then the handleFileUpload()

        if(!upload){
            FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error", "You do not have permission to upload.");
            FacesContext.getCurrentInstance().addMessage(null, msg);
        }
        ...

“B.jsf” -> managed bean: bean2

 ...
 <p:growl id="msgs" showDetail="true"/>
 ...

When I click upload, it give me a growl error message “You do not have permission to upload.”, which is good. But then when I click “Back”, which will take me to B.jsf, I see the growl message “You do not have permission to upload.” again. What seem to be happening is as I click the “Back”, I send other form request to upload, which then generated the same error message, which then being displayed at B.jsf. Is there a way to fix this, beside putting the “Back” button into an empty form, because now I have two buttons standing on top of each others, instead of side by side. I try to do this:

FacesContext.getCurrentInstance().addMessage("tom", msg);

hoping that it would send to component with id=”tom”, so then the growl with id=msgs, would not get load, but no luck. I try to turn the upload flag on when I click the Back button, but the web form get requested before the method that handle the back navigation get called.

It is not as brief as I want it to be, therefore I want apologize for it 😀

  • 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-16T17:12:31+00:00Added an answer on May 16, 2026 at 5:12 pm

    beside putting the “Back” button into an empty form, because now I have two buttons standing on top of each others

    The HTML <form> is by default a block element. HTML block elements are by default been placed in a new line. You actually want to make it an inline element. You can do this using display: inline; in CSS.

    Back to the actual problem, it however surprises me that the fileUploadListener method is called in spite of the immediate="true" in the p:commandButton. I tried to reproduce this and I can confirm this. But I wouldn’t expect it to happen. Normally the immediate="true" on a button is the solution to skip submitting of the “whole” form (at least, skip the UIInput components without this attribute). Further investigation learnt me that the p:fileUpload isn’t an UIInput component at all and that the listener is fired during apply request values phase instead of validations or update model values phase. So this behaviour is fully predictable, but imo still an oversight in the design.

    Since the p:fileUpload requires ajax="false" on the p:commandButton component, you can on the other hand also just remove it from the back button so that it fires an ajaxical request and hereby skips the fileUploadListener being called.

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

Sidebar

Related Questions

I will try to be brief/detailed about what i am trying to do here.
I will try to be as brief as possible... I have published a very
I will try to be as clear as possible because I can't get anybody
I will try to keep this as simple as possible. I have a rather
I will try to be specific if I can - please be patient, first
I will try and be brief, I am finding when trying to create a
I'll try to be brief here. I'm trying to implement A Star on Python,
I will try to explain myself as best as possible, I know the title
I will try and explain my problem as accurately as possible, I don't think
I will try to make this as straight forward as possible. This question does

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.