Hi
I have created menuItem component and tried to create Action Listener object and setting it to the component in the backing bean.
but it is throwing methodnot found exception.
javax.el.MethodNotFoundException: Method not found: com.mkyong.common.BreadCrumbBean@4786a2.test()
javax.faces.el.MethodNotFoundException: javax.el.MethodNotFoundException: Method not found: com.mkyong.common.BreadCrumbBean@4786a2.test()
at com.sun.faces.application.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:92)
Below is my code..
MenuItem item1 = new MenuItem();
item1.setValue(key);
Application app = FacesContext.getCurrentInstance().getApplication();
javax.faces.el.MethodBinding actionListener = app.createMethodBinding("#{breadCrumbBean.test}", null);
item1.setActionListener(actionListener);
Let me know whether i created actionListener object or not.
Thanks
MethodNotFoundException for dynamically created component
Hi suneetha,
well, I don't like this sentence. But I was facing exactly same problem.
You have to specify the ActionEvent in your second parameter
----------------------------------------------------------------------------------------------------------
Furthermore I ve got a question:
Due to the fact that setActionListener is deprecated, could anyone tell me how to declare an actionListener via Expression or is this not possible?
In this case my ActionEvent Parameter is null during runtime.
well, I don't like this sentence. But I was facing exactly same problem.
You have to specify the ActionEvent in your second parameter
Code: Select all
menuItem.setActionListener(context.getApplication().createMethodBinding("#{testBean.actionListenerMethod}",
new Class[] {ActionEvent.class}));
Furthermore I ve got a question:
Due to the fact that setActionListener is deprecated, could anyone tell me how to declare an actionListener via Expression or is this not possible?
Code: Select all
menuItem.setActionExpression(expressionFactory.createMethodExpression(
el, "#{testBean.changePartner(javax.faces.event.ActionEvent)}",
null, new Class[] {ActionEvent.class}));
-
- Information
-
Who is online
Users browsing this forum: Majestic-12 [Bot] and 45 guests