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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T20:13:16+00:00 2026-06-18T20:13:16+00:00

I changed my static menu file (header.xhtml) with a mega menu with a model.

  • 0

I changed my static menu file (header.xhtml) with a mega menu with a model.
Like this:

          <p:megaMenu model="#{menuController.megaModel}" autoDisplay="false" styleClass="menu-bar"  >

          </p:megaMenu>

So far so good, its working great and building just like I expected.
The problem is, on my form pages, when validation fails for the secound time…
I get this error:

 javax.faces.FacesException: Cannot remove the same component twice: j_idt15:j_id2     com.sun.faces.context.StateContext$AddRemoveListener.handleAddRemoveWithAutoPrune(StateContext.java:493)
        com.sun.faces.context.StateContext$AddRemoveListener.handleRemove(StateContext.java:372)

Looking at the generated HTML I cant find this String “j_idt15:j_id2”, but I can find:

   <div id="j_idt14:j_idt15" class="ui-menu ui-menubar ui-megamenu ui-widget ui-widget-content ui-corner-all ui-helper-clearfix menu-bar" role="menubar">

and this:

So… I really don´t understand. My MenuController is a sessionBean:

@Component
@Scope("session")
public class MenuController implements Serializable {

@PostConstruct
   public void init(){
   todosModulos = moduloService.findAll();
   modulosAcesso = extrairModulos();
   createMegaMenu();
}

…So.. some notes:

I figured out that this error occurs on versions of Mojarra above 2.1.9.
(I am using 2.1.10). So one possible solution is changing the JSF imp to My Faces.
I Tried that, but it buged my structure (my composite components stoped working and dynaForm also).

I tried some workarounds but no sucess. This is what I tried:
Overriding AbstractMenu and Marlon Patrick’s solution (PT-BR).

Simply doesn´t work =[

EDIT -> Creating the MenuItem

 MenuItem anItem = new MenuItem();
 anItem.setOutcome(item.getOutcome());
 anItem.setValue(item.getRotulo());
 anItem.setIcon(item.getIcone());       
  • 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-18T20:13:17+00:00Added an answer on June 18, 2026 at 8:13 pm

    From what I saw you already tried my two workarounds: overwrite AbstractMenu and put PhaseListener.

    Well, what I realize is that the component that was the problem I had MenuBar and what you are trying to use is the MegaMenu, perhaps the solutions that I do not work for MegaMenu, although I believe that should work yes.

    What I would say to you is to check the following:

    1 – When you override the class AbstractMenu you are sure the PrimeFaces started to use it? To make sure it puts a break point there and if he sees to the execution flow. If you do not stop, because PrimeFaces is still using its own class.

    2 – When attempting to use the solution with PhaseListener, which I prefer and use today, you noted that you need to replace a piece of code with your own code? Basically you’ll have to remove only the actions of menu items that are links, because they are causing this problem. The menu items are actions that should remain. In my case, I knew what actions were or links by ID, then you will have to differentiate somehow believe that by also id. Also, put a break point to make sure that your PhaseListener was duly registered and that is intercepting the flow of execution.

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

Sidebar

Related Questions

Statement: Static member variables can be ONLY changed by static methods. Is this statement
My horizontal navigation bar looks like this: | MENU-ITEM 1 | MENU-ITEM-2 | MENU-ITEM
I changed this: static GtkActionEntry menu_items[] = { { OpenFile, GTK_STOCK_OPEN, NULL, <control>O, NULL,
Is there any way to make this work in Java? public static void change(List<?
I have a dropdown menu that is generated in a different file. It is
I've got an activity, where I initialize some static variable (Menu of the app).
I would like to use a flash menu in Asp.net 2.0. However, I have
If FocusManager is enabled, then hiding a grid column via the menu header causes
How to apply CSS class file to a Menu item control.I have a menu
Ok, so I am trying to have a static menu on the left side

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.