0

以下 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) {
    ...

它将以下枚举类型作为参数:

公共枚举 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

有什么想法可能会出错吗?

4

0 回答 0