After selecting a radio option in my .xhtml
page, it will invoke my backing bean method to dynamically construct a menu item with values from DB, and render it .xhtml
page.
<p:selectOneRadio id="userRadio" value="#{applicationBean.selectedUser}" >
<f:selectItems value="#{applicationBean.usernames1}" />
<p:ajax event="change" listener="#{applicationBean.displayCommands}" update="commandmenu" />
</p:selectOneRadio>
<p:menu model="#{applicationBean.model}" id="commandmenu" rendered="#{applicationBean.menudisplay}"/>
backing bean method
public void displayCommands(AjaxBehaviorEvent event)
{
System.out.println("The selected user is... "+selectedUser);
Map<String, String> commands =userCommand.get(selectedUser);
if(commands!=null)
{
System.out.println("the number of commands are.."+commands.size());
for (Map.Entry<String,String> entry : commands.entrySet())
{
System.out.println("Key = " + entry.getKey() + ", Value = " + entry.getValue());
}
}
this.menudisplay = true;
FacesContext.getCurrentInstance().renderResponse();
}
but the p:menu is not rendered. intially