以下JSF视图片段:
<h:commandLink value="Search" action="#{personSearch.search('SEARCH_TERM')}" styleClass="btn btn-primary" />
<h:commandLink value="Search" action="#{personSearch.search('SPECIALITY_CODE')}" styleClass="btn btn-primary" />
调用以下bean方法:
public void search(SearchType searchType) {
...
将以下枚举类型作为参数:
public enum SearchType {SEARCH_TERM,SPECIALITY_CODE}
使用MethodNotFoundException失败:
10:34:06,851 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/core-webapp].[FacesServlet]] (http--0.0.0.0-8080-1) Servlet.service() for servlet FacesServlet threw exception: javax.el.MethodNotFoundException: /person/search.xhtml @59,39 action="#{personSearch.search('SPECIALITY_CODE')}": Method not found: Proxy for view class: net.hl.core.view.PersonSearch of EJB: PersonSearch.search(java.lang.String)
at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:109) [jsf-impl-2.1.7-jbossorg-2.jar:]
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102) [jsf-impl-2.1.7-jbossorg-2.jar:]
at javax.faces.component.UICommand.broadcast(UICommand.java:315) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81) [jsf-impl-2.1.7-jbossorg-2.jar:]
我正在使用 JBoss AS 7.1.1.Final与Mojarra 2.1.7-jbossorg-1 。
任何可能出错的想法?