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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T01:41:39+00:00 2026-06-04T01:41:39+00:00

I am trying out Primefaces 3 using glassfish and eclipse. I wanted to utilize

  • 0

I am trying out Primefaces 3 using glassfish and eclipse.

I wanted to utilize Primefaces Dialog when creating or entering user details.
Suppose for example in a page, I have a Create button that when clicked would show this dialog.

<p:dialog id="dialog"  widgetVar="dlg1">
    <h:form id="addMemberForm">
            <!-- More code here -->
            <f:facet name="footer">
                <p:commandButton value="Save"
                    actionListener="#{myBean.save}"
                    oncomplete="dlg1.hide()"  />
            </f:facet>
        </p:panelGrid>
    </h:form>
</p:dialog>

..and when my save button is clicked, execute this code.

public class MyBean{
    public void save(ActionEvent event) {
        try{
            myEJB.addMember(newMember);
            //how to show message
        }catch(Exception e){
            e.printStackTrace();
        }
    }
}

How do I show a dialog popup message to the user when the add is successful.

I tried it with this code but this doesn’t show up and the dialog gets dismissed.

FacesMessage facesMessage = new FacesMessage("Successful add!");
FacesContext.getCurrentInstance().addMessage(null, facesMessage);

I was thinking that this is an ajax submit so everything gets cleared.

I think I have to execute some code during the oncomplete but I dont know how to do 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-06-04T01:41:40+00:00Added an answer on June 4, 2026 at 1:41 am

    You should update a message tag from your ajax request.

    Assuming you have a global message tag like this on your page:

    <h:messages id="msg"/>
    

    Since it is not inside the dialog’s form you need to address it in the update attribute of p:commandButton with an absolute id:

    <p:commandButton value="Save"
                     actionListener="#{myBean.save}"
                     oncomplete="dlg1.hide()"
                     update=":msg"  />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Am trying out an example app using UITableView. The upper (nearly) half of the
Am trying out Ruby on Rails in Windows XP using the Hello World example.
I am trying to figure out, how the primefaces in-cell editor works. For some
I trying out using regEx to split a String which gives me an array
Im trying out an example with EJB Session Beans. I wanna see the differences
I am trying out TorqueBox and having issues with my deployment descriptor. I'm using
I am trying out nservicebus as a solution instead of using WCF MSMQ binding.
Trying out node.js for the first time. Set up node, set up the example
Trying out the example usage of codebrew rails-backbone , everything works fine but the
Trying out the examples found on pleac.sf.net , I'm not able to get an

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.