3

I am getting the following error when I click the commandbutton in the datatable which appears in each row. By looking at the example I understand that once commandbutton is clicked, the follwoing code first gets executed

 <f:setPropertyActionListener value="#{detailRow}" target="#{tableBeanDetail.selectedEntry}" />  

and then the code associated with the following bean method

  <p:commandButton id="detailsButton" actionListener="#{tableBeanDetail.onRowSelect}" icon="ui-icon-
      search" title="View Details">  

where in my onRowSelect i am trying to do the following:

  public String onRowSelect(ActionEvent event) throws Exception {


    // Get key fields from row data and set the parameters that needs to be passed w
             .....
 }

I get the following error:

Peter
  • 131
  • 1
  • 14
  • You forgot to include the entire stacktrace in your question. – BalusC Mar 22 '12 at 01:10
  • So nice to hear from you, BalusC. I was thinking that I probablly annoyed you by asking those dumb questions. I was just going through your article on Using Datatables. You explain so well! BTW I could get rid of that issue by removing comment tags from Xhtml but getting another error. I would like you to have a look at that error but I am not sure how to use Markdowns for formatting in comments area. I am getting an error messgae. – Peter Mar 22 '12 at 03:30
  • Just edit the question, paste the stacktrace, select it and press Ctrl+K (or the `{}` button in editor toolbar) to format it as code (it's basically a matter of indenting the lines with 4 spaces). – BalusC Mar 22 '12 at 03:31
  • Just did that. Thanks for taking time and looking in to this. – Peter Mar 22 '12 at 03:51

1 Answers1

8

The actionListener methods should have the following signature:

public void someMethodName(ActionEvent event) {
    // ...
}

where ActionEvent is of javax.faces.event package (and thus not java.awt package!).

You're however returning a String and it's not clear if your ActionEvent is of the right package. But you seem want to perform a navigation. You should be using action instead of actionListener and remove that ActionEvent argument.

public String onRowSelect() {
    // ...
}

See also:

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • Thank you BalucS! It works. And thanks for providing those links too. I need lot of reading. But many thanks, indeed. One quick question, what are those numbers right above the tick mark when a question is answered. Somewhere I have seen ver high numbers in two digits. Alos is there anything on this site that people like me can do for the gentlemen like you are always to there to help. I mean I saw a tab Vote but I do not know much about that. – Peter Mar 22 '12 at 04:27
  • Everyone can click the top arrow to "upvote" the post. E.g. when the content is valuable and useful for the reader. On the other hand, everyone can also click the down arrow to "downvote" the post. E.g. when the content is bad, misleading or utter crap. Answers are by default ordered by votes, so the best answer comes in top, regardless of the post time. See also http://stackoverflow.com/faq – BalusC Mar 22 '12 at 04:32