I am invoking a method from rendered attribute, where I noticed that the method is triggered multiple times in RENDER_RESPONSE phase.
It was also noticed that the method was trigered many times in other phases (APPLY_REQUEST_VALUES, PROCESS_VALIDATIONS etc.) also.
I saw a related query (Why is the getter called so many times by the rendered attribute?) where the reason behind these calls were told.
Is there a way where we can control this, so that the method is invoked only once.
My usage
<rich:panelMenuItem label="Menu1" actionListener="#{testMenuMB.panelMenuClickedAjax}" rendered="#{testMenuMB.checkForRendering('RoleA,RoleB')}"></rich:panelMenuItem>
public boolean checkForRendering(String rolesString){
System.out.println("Roles-->"+rolesString+FacesContext.getCurrentInstance().getCurrentPhaseId());
boolean authorized = false;
String [] rolesArray = rolesString.split(",");
for (String string : rolesArray) {
if(string!=null && accesibleRolesMap.containsKey(string)){
authorized = true;
break;
}
}
return authorized;
}