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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:40:10+00:00 2026-06-04T12:40:10+00:00

As an exercise I want to have a menu bar which is disabled until

  • 0

As an exercise I want to have a menu bar which is disabled until the user logs in. When he logs in I want to call something which will trigger an update. The menu bar is in the master.xhtml template file

<h:form >
  <p:menubar id="masterMenuBar">
  <p:menuitem disabled="#{backing.disableMenu}" value="List users" />
  </p:menubar>
</h:form>

As part of the login I have code to refresh the form

public void refreshForm() {
  RequestContext context = RequestContext.getCurrentInstance(); 
  context.update("form1"); 
  context.update("masterMenuBar");
}

I tried my luck with calling a context update to my defined label of masterMenuBar but the RequestContext apparently doesn’t include my calling template form (which sounds reasonable enough).

Is there some other context I can call which will include a context update to my menu bar? Perhaps I am on the wrong path, and there is a better way to achieve the same thing?

I did notice that even resizing the browser wasn’t reason enough to call again to my backing.disableMenu bean. Apparently I need something fairly strong to cause it to reach my bean a second time.

  • 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-04T12:40:12+00:00Added an answer on June 4, 2026 at 12:40 pm

    You need to pass the absolute client ID, not the relative client ID. If you rightclick and view source in browser, then you’ll see that the masterMenuBar element has the (autogenerated) ID of its form prefixed.

    You need to give the form where the menu is sitting in a fixed ID

    <h:form id="menuForm">
        <p:menubar id="masterMenuBar">
            ...
    

    and pass the absolute client ID instead.

    context.update("menuForm:masterMenuBar");
    

    Update: sorry, it shouldn’t start with : in contrary to the update attribute of <p:commandButton>.

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

Sidebar

Related Questions

In XCode 4.2, I have some logic tests that I want to exercise against
I have text stored in a variable which contains several span tags. I want
I have some unit tests which exercise code which makes calls out to a
I'm going through exercises of a C++ book. For each exercise I want to
For this exercise I'm making I want a decimal < 4096 to be written
I want to write a simple web proxy, for exercise. Here's the code I
As an exercise in good OO methods and design, I want to know what
Basically I want to have a single construct to deal with serializing to both
I have a simple address book app that I want to make searchable. The
I have found this question in the one site which was about counting sort

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.