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 8813549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:52:59+00:00 2026-06-14T03:52:59+00:00

Just would like to know why do I encounter this behavior in my application.

  • 0

Just would like to know why do I encounter this behavior in my application.

I used primefaces for the UI and almost all of my pages follows this pattern. I heavily used AJAX in all of my CRUD
operations and using dialogs to show it to the user.

<ui:composition template="myTemplate.xhtml">
    <ui:define name="content">
        <ui:include
            src="/pages/CreateDialog.xhtml" />
        <ui:include
            src="/pages/UpdateDialog.xhtml" />
        <ui:include
            src="/pages/DeleteDialog.xhtml" />
    </ui:define>
</ui:composition>

My only concern is that, after doing CRUD stuff in my dialogs and user accidentally clicks F5 or refresh on the browser,
FF/Chrome and other browser always mentioned

To display this page, Firefox must send repeat action...

Obviously this will cause double submit. Previously I used Post-Redirect-Get in this scenario in older apps but since this
is AJAX JSF update then I cannot do this.

What’s the workaround for this and is this normal? I thought AJAX actions should not trigger again during browser refresh.

Help?

UPDATE

I am opening my dialog with this code

<p:commandButton value="Add" 
        onclick="createWidget.show();"
        update=":CreateForm"
        action="#{MyBean.add}" 
        />

My create dialog uses this

<p:dialog  header="Create">
    <h:form id="CreateForm" prependId="false">
        <p:commandButton value="Add" icon="ui-icon-plus"
            actionListener="#{MyBean.add}"
            update=":messageGrowl" 
            oncomplete="closeDialogIfSucess(xhr, status, args, createWidget 'createDialogId')"/>
    </h:form>
</p:dialog>

I actually am following the pages from this site…Full WebApplication JSF EJB JPA JAAS

  • 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-06-14T03:53:00+00:00Added an answer on June 14, 2026 at 3:53 am

    Already experienced a few times that having JavaScript errors in callback methods ends up in such behavior. I was able to reproduce your problem which is disappeared after correcting the callback signature:

    oncomplete="closeDialogIfSucess(xhr, status, args, createWidget, 'createDialogId')"
    

    accordingly to you JavaScript function signature:

    function closeDialogIfSucess(xhr, status, args, createWidget, dialogid)
    

    (Sure if your JavaScript call has only 3 parameters then correct the oncomplete call)

    Unrelated: I guess that you are using this function to close a specific dialog. Another way doing it would be assigning widgetVar attribute to your dialog:

    <p:dialog id="testDialog"  header="Create" widgetVar="createWidget">
        <h:form id="CreateForm" prependId="false">
            ...
        </h:form>
    </p:dialog>
    

    The widgetVar object will represent your dialog in the callback function so you can close it by call the hide() function of dialog:

    function closeDialogIfSucess(xhr, status, args, createWidget) {
        if(args.validationFailed || !args.loggedIn) {  
            jQuery('#testDialog').effect("shake", { times:3 }, 100);  
        } else {  
            createWidget.hide();  
        }  
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there anything like this outside of the application delegate? I would just like
I just would like to know what format and codec would use the least
I just would like to know if it is possible (and if yes how)
I would just like to know if there is any advantage to having a
I am just learning and would like to know about a piece of code
I am new to coding and would just like to know a bit more
I'm debugging multi-threaded code and I would just like to know if a line
I'm just learning Erlang with Chicago Boss and would like to know how could
I just would like to know if it is possible, in any way, to
I have an std::vector<unsigned char> with binary data in. I just would like to

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.