开发者

creating dynamic rich:dropdownmenu

MethodExpression methodExpression =  
     application.getExpressionFactory().createMethodExpression( 
         FacesContext.getCurrentInstance().getELContext(),  
         "#{PrismBacking.onItemClick}",  
         null,  
         new Class[] { ActionEvent.class }); 
menuItem.setActionExpression(methodExpressi开发者_Python百科on); 

I created a dynamic drop down as above my creating action listener but the listener was not called. I included the method inside the getter of dropdown in backing bean. Do I have to configure the action listener in any of the config files. kindly help.


I don't do RichFaces, so it may behave different, but with "plain" JSF you'll at least have to set a fixed ID on the UICommand component manually.

menuItem.setId("someFixedId");

Also ensure that the method behind "#{PrismBacking.onItemClick}" has exactly this signature:

public void onItemClick(ActionEvent event) {
    // ...
}

Although that should otherwise have produced a pretty self-explaining exception.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜