Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback, please email oracle-forums_moderators_us@oracle.com

Hidefew select items with HahMap values

vijay dasariMar 13 2024

JDev: 12.2.1.4.0

Hello Team,

I have requirement to hide few select items based on conditions.

SO We have stores values in HashMap and written condition to rendered in UI but it's not wokring

Can anyone help us

<af:selectOneChoice value="#{bindings.DepartmentId.inputValue}" label="#{bindings.DepartmentId.label}"
required="#{bindings.DepartmentId.hints.mandatory}"
shortDesc="#{bindings.DepartmentId.hints.tooltip}" id="soc2">
<!--<f:selectItems value="#{bindings.DepartmentId.items}" id="si2"/>
<f:validator binding="#{bindings.DepartmentId.validator}"/>-->

<af:forEach items="#{bindings.DepartmentId.items}" var="item" varStatus="vs">
<af:selectItem label="#{item.label}}" id="si2" value="#{item.value}" rendered="#{item.value eq MyBean.roles[item.value]}"/>
</af:forEach>
</af:selectOneChoice>

I written sample application in HR schema.

Bean code:

public Map getRoles() {  
   if(roles.isEmpty()){  
   Map r=new HashMap();  
   r.put("10", "10");  
   r.put("20", "20");  
        
   return r;  
   }else{  
   return roles;  
   }  

}

private Map roles=new HashMap();

public void setRoles(Map roles) {
this.roles = roles;
}

Comments
Post Details
Added on Mar 13 2024
3 comments
109 views