0

I am fairly new to JSF and am currently a frontend developer for a new project. I do not have access to the backend code and need to create a solution with the data I have access to on the page.

Currently I have a menu and there are security controllers on HTML elements to control visibility.

Example: style="#{security.ConfigMenu?'visibility:visible':'visibility:hidden;width:0px;height:0px;padding-bottom: 0px;'}"

This page is hardcoded and need to make it more dynamic.

I need to evaluate this expression but use an array of beans stored as strings

var security = ["security.ConfigMenu", "security.AdminMenu", "security.Dashboardmenu"];

Need to handle #{mappSec.insightsConfigMenu'} with #{security[0]}

Is this possible?

I tried to replace the bean call with a string using the bean name

#{bean.method}

with

var bean = "bean.method"; #{bean}

Jasper de Vries
  • 19,370
  • 6
  • 64
  • 102
Jim Burke
  • 31
  • 4
  • Does this answer your question? [Dynamically call method in EL, which is evaluated from a String](https://stackoverflow.com/questions/33239644/dynamically-call-method-in-el-which-is-evaluated-from-a-string) – Jasper de Vries Feb 06 '23 at 16:34
  • No, this does not work but thank you. I need to have a string which represents a bean and a beans method call to be interpreted as such. I am not sure if this is possible – Jim Burke Feb 06 '23 at 17:12
  • I figured out the issue. If you make your variable = to the call then it will work. For example: var bean = "#{mybean.IsThisGood}"; What doesn't work is building the variable like var bean = "#{" + "mybean.IsThisGood"+ "}"; – Jim Burke Feb 06 '23 at 22:27

0 Answers0