my dog learned polymorphism*
The moose likes JSF and the fly likes How do I set actionListeners in code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "How do I set actionListeners in code" Watch "How do I set actionListeners in code" New topic
Author

How do I set actionListeners in code

seb petterson
Ranch Hand

Joined: Mar 04, 2005
Posts: 118
If in java code of a managed bean I have:

And in the same bean thres a methdo:


What is the java code for setting setSortOrder as an actionListener on the commandLink object?

Thanks.
Garann Means
Ranch Hand

Joined: Jan 28, 2002
Posts: 214
I think it's like this..


[ September 19, 2005: Message edited by: Garann Rose Means ]
seb petterson
Ranch Hand

Joined: Mar 04, 2005
Posts: 118
Originally posted by Garann Rose Means:
I think it's like this..



[ September 19, 2005: Message edited by: Garann Rose Means ]


Thank you, that is what I thought too. But a javax.faces.el.MethodNotFoundException is thrown. It says it can't find the method setSortOrder() in the class. Which is correct since setSortOrder takes an ActionEvent, that is setSortOrder(ActionEvent ae) is defined, but not setSortOrder().

What am I doing wrong, setSortOrder should take an ActionEvent right, since it's an an action listener, right?
seb petterson
Ranch Hand

Joined: Mar 04, 2005
Posts: 118
Ok, solved it, this is the code that worked:

[ September 20, 2005: Message edited by: seb petterson ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How do I set actionListeners in code