在我的.xhtml
页面中选择了一个单选选项后,它将调用我的支持 bean 方法来动态地构造一个带有来自 DB 的值的菜单项,并呈现它的.xhtml
页面。
<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}"/>
后备豆法
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();
}
但 p:menu 未呈现。最初