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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:06:55+00:00 2026-06-13T23:06:55+00:00

I have a p:commandButton on click of which I need to add a few

  • 0

I have a p:commandButton on click of which I need to add a few values to a list. In my managed bean, I’m validating the value that has to be added, and if it validates to false, I have to display a confirmation popup. This is my code –

<p:commandButton id="add" value="Add" type="submit"                                      action="#{bean.doAdd}" ajax="false"
update=":List"/>

And in the bean, on click of the “Add” button,

public String doAdd() throws Exception {
        if(response != null) {
            if(keyList.contains(response))  {
                if(!responseList.contains(response)) {
                    responseList.add(response);
                } 
            } else {
               //Have to display confirmation popup.
            }
            response = "";
        }

        return response;
    }

I’m using jsf 2.0 and primefaces 3.0. Can someone please tell me how to display the popup from the bean?

  • 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-13T23:06:55+00:00Added an answer on June 13, 2026 at 11:06 pm

    You can use RequestContext to run js code inside your managed bean

    Make sure its an ajax call – got no ajax="false"

    like this

    RequestContext context = RequestContext.getCurrentInstance();  
    context.execute("YourDialogwidgetVar.show()");
    

    I assume you got some dialog defined…

    <p:confirmDialog id="confirmDialog" message="Hello"  
                    header="Header" widgetVar="YourDialogwidgetVar">  
    </p:confirmDialog> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following layout in my page (simplified) <h:form> <h:commandButton action=#{bean.save} value=Save/> <rich:tabPanel
I have the following Dropdown list, which has a Event associated with it, when
I have an a4j:commandButton which looks like this <a4j:commandButton id=stopBtn type=button reRender=lastOp action=#{MyBacking.stop} value=Stop
I have something like: <h:commandButton> <h:ajax event=click listener=#{controller.onLog} onchange=onLogProcess /> .... </h:commandButton> I send
I have a Facelets Composite component that includes, among other things, a commandButton: <?xml
Suppose i have JSF page <h:body> <h:form id=formID prependId=false> <h:outputText id=randomID value=#{randomNumber.random}/> <h:commandButton id=buttonID
I have a visualforce page which is rendering correctly. There is a commandbutton Save
I have a UI that has options to upload multiple documents of specific natures
I have a commandButton in JSF 2.0 with a actionvalue that I want to
I have a data table. Each row of the table has a commandButton called

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.