This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
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


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 ]
 
GeeCON Prague 2014
 
subject: How do I set actionListeners in code