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.
精彩评论