Search code examples
jspjsficefacescommandbuttonmethodnotfound

javax.el.MethodNotFoundException on <ice:commandButton actionListener>


I'm working with the JSF Framework icefaces (Just in case it matters) within a full working system which was built up with JSF/JavaEE5. So, I started by adding a JSP page and a Java bean. As far as I know, each time a binding(or actionListener) is declared in the Jsp side, there is the need of declaring a variable, an action, and getter/setter within the bean. So I did, as follows:

JSP:

 <ice:commandButton actionListener="#{tasks$fixTemplates.btnSearchProcessAction}"
                    style="height: 18px; left: 5px; top: 8px; position: absolute; 
                    width: 18px;" value="submit"/>id="btnSearch" 
                    image="/resources/commons/imgs/dot/view.png">

Java bean:

  public void btnSearchProcessAction(ActionEvent ae) throws Exception { 

 //Some code over here

  }

The page is being rendered without so much trouble, however when I attempt to perform an action by pressing a button it throws an exception, which says something like:

javax.faces.el.MethodNotFoundException: javax.el.MethodNotFoundException: Method not found: com.rcsolutions.base.tasks.fixTemplates@1ec7c9.btnSearchProcessAction(javax.faces.event.ActionEvent)

At first I thought, it was being thrown because I had forgotten to add the managed-bean within faces-config file, but it's already there and it hasn't worked yet. I'm not sure why it says that, because I've seen a bunch of code following the same pattern. What seems to be the problem? Have I skipped any setting before coding or so? Any help would be welcomed.


Solution

  • It was a bit tricky to find out what was going on, at last it turned out I relied on IDE hints (what is not that good) so I hand't noticed and there was an incorrect import for the ActionEvent. I've got this:

    import java.awt.event.ActionEvent;
    

    When what I really needed was this:

    import javax.faces.event.ActionEvent;