javax.el.MethodNotFoundException:找不到方法:TableBeanDetail@bd4053.onRowSelect()

Pet*_*ter 3 jsf jsp primefaces

当我单击每行中出现的数据表中的命令按钮时,我收到以下错误.通过查看示例,我了解到一旦单击了commandbutton,就会首先执行以下代码

 <f:setPropertyActionListener value="#{detailRow}" target="#{tableBeanDetail.selectedEntry}" />  
Run Code Online (Sandbox Code Playgroud)

然后是与以下bean方法关联的代码

  <p:commandButton id="detailsButton" actionListener="#{tableBeanDetail.onRowSelect}" icon="ui-icon-
      search" title="View Details">  
Run Code Online (Sandbox Code Playgroud)

在我的onRowSelect中我试图做以下事情:

  public String onRowSelect(ActionEvent event) throws Exception {


    // Get key fields from row data and set the parameters that needs to be passed w
             .....
 }
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

Bal*_*usC 8

actionListener方法应具有以下特征:

public void someMethodName(ActionEvent event) {
    // ...
}
Run Code Online (Sandbox Code Playgroud)

这里ActionEventjavax.faces.event包(因此不java.awt包!).

然而,你回来了String,目前尚不清楚你ActionEvent的包装是否合适.但你似乎想要执行导航.您应该使用action而不是actionListener删除该ActionEvent参数.

public String onRowSelect() {
    // ...
}
Run Code Online (Sandbox Code Playgroud)

也可以看看: