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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T08:05:55+00:00 2026-06-08T08:05:55+00:00

How do you invoke a bean method from Javascript in PrimeFaces? I have the

  • 0

How do you invoke a bean method from Javascript in PrimeFaces?

I have the following menuItem:

<p:menuitem id="toggleAlarms" icon="ui-icon-cancel" rendered="#{navigationBean.admin}" value="Cancel Alert" update=":alarmMessages"  action="#{alarmsBean.toggleAlertOff()}"/>

When I click on that item in the UI the method gets called.

But when I have this element:

<p:messages id="alarmMessages">
    <script>
    jQuery('#alarmMessages').effect("pulsate", {times:5}, 1000 );
    jQuery('#alarmMessages').show();
    $('#alarmMessages').click(function() {
        jQuery('#toggleAlarms').click();
        alert('fool');
    })
    </script>
</p:messages>

If I click on the messages object on the UI, I can see the alert message with fool in it.

However, I never see the toggleAlarms.click() method invoke the alarmsBean.toggleAlertOff() call.

Am I doing something wrong?

  • 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-08T08:05:57+00:00Added an answer on June 8, 2026 at 8:05 am

    any chance that #{navigationBean.admin} returns false ?

    cause if so you wont be able to find it in the DOM… (maybe better use style=display:none)

    also , your selector might be wrong if the menuitem is inside form try jQuery('#someFormID\\:toggleAlarms').click(); do view source on your web page to see the right id of the menuitem

    finally try the same with commandButton instead (not sure that menuitem will respond as expected to .click())

    Update

    in order to check if your jquery selector is right use alert($('#toggleAlarms').length) instead of alert('fool');

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

Sidebar

Related Questions

How can I invoke a method from backing bean before popup panel shows? <h:commandButton
Is exists the way to invoke the method of stateless session bean from WebSphere
I would like to know how to Invoke bean method from jsp. something like.
Primefaces 2.2.1 Mojarra 2.1.2 I have a sophisticated method in my jsf bean :
I am trying to invoke the method typeOfInstance() in the following (simplest) code: import
I'm trying to invoke a method from another class that means I want to
How can I invoke overloaded generic method in IronRuby? I have a .NET class
Is it possible to invoke a transactional method from within a Stateful EJB itself?
I have declared a bean which is instantiated via a factory method. The factory
I have a question about the method signature in a JSF Bean when it's

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.