问题描述
我无法在Richfaces 4.3.0中复制该示例.最终展示: http://showcase.richfaces.org/richfaces/component -sample.jsf?demo = panelMenu& skin = blueSky 特别是在rich:panelMenu组件中,当我运行代码时,panelMenu不响应,并且panelMenuItem不显示,我更改了这样的代码:
Hi i can't replicate the example in the richfaces 4.3.0.Final showcase: http://showcase.richfaces.org/richfaces/component-sample.jsf?demo=panelMenu&skin=blueSkySpecifically in the rich:panelMenu component, when i run the code the panelMenu doesn't responde,and the panelMenuItem doesn't show, I change the code like this:
<rich:panelMenu style="width:200px" itemMode="ajax" groupMode="ajax">
到
<rich:panelMenu style="width:200px" mode="ajax">
和panelMenuItems显示并正常工作,但是此部分不起作用:
and the panelMenuItems show and working, but this part doesn't work:
<a4j:outputPanel ajaxRendered="true">
<rich:panel rendered="#{not empty panelMenuBean.current}">
<h:outputText value="#{panelMenuBean.current} selected" id="current" />
</rich:panel>
</a4j:outputPanel>
为什么? tnks.
推荐答案
我刚刚使用了展示柜中完全相同的代码进行了测试(我只是复制了整个h:form
),并且一切正常.
I've just tested with the exact same code from the showcase (I simply copied the whole h:form
), and it worked alright.
您只需要使用current
字符串属性和updateCurrent
侦听器方法创建一个名为PanelMenuBean
的支持bean(根据itemChangeListener的ItemChangeEvent: //docs.jboss.org/richfaces/latest_4_X/vdldoc/rich/panelMenu.html"rel =" nofollow> panelMenu的VDL文档):
You just have to create a backing bean called PanelMenuBean
with the current
String property and the updateCurrent
listener method (receiving an ItemChangeEvent for the itemChangeListener
attribute, according to the VDL docs for panelMenu):
@ManagedBean
public class PanelMenuBean {
private String current;
public void updateCurrent(ItemChangeEvent evt) {
current = evt.getNewItemName();
}
// getter and setter ...
}
这篇关于错误丰富:panelMenu示例展示无法呈现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!