1

The following code isn't working (as it also doesn't work for DefaultMenuItem): Using Primefaces 5.3 and setting the model attribute of a TieredMenu.

DefaultSubMenu submenuModulo = new DefaultSubMenu();
submenuModulo.setId(sisModulo.getCodModulo());
submenuModulo.setLabel("#{pptMenu." + sisModulo.getDesModulo() + "}");
submenuModulo.setIcon(sisModulo.getDesIcone());
submenuModulo.setExpanded(false);

I need to use EL expression when setting the label, so the label is translate when there is a language switch. The menu is build in a static way, so I don't have to read it from the database again. I don't want to recreate the menu when the language changes.

EDIT: This question has nothing to do with the question marked as duplicate. I found the answer myself, but I can't post the answer. I created a custom TieredMenuRenderer renderer that accepts EL in Label of DefaultSubMenu and in the value of DefaultMenuItem. (as it should be by default)

ChRoNoN
  • 860
  • 8
  • 18
  • This not a duplicate, I was asking how to use EL expression when setting the Label, I figure it out, created a custom renderer from TieredMenuRenderer – ChRoNoN Jun 16 '16 at 20:31
  • The question was: "how I do make DefaultSubMenu accept EL expression?" Not "how do I access properties files from managed bean". You are tagging it as duplicate just because you want to. It should accept EL expressions by default just like it does when declaring in a xhtml file. – ChRoNoN Jun 21 '16 at 12:56

0 Answers0