File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How do I set actionListeners in code
 
Similar Threads
assigning parameters at runtime
JSF Custom Component ,IBM Portal 7
How to ActionListener manually in custom renderer?
How to highlight a selected tab(link) implemented by <h:commandLink> inside <rich:toolBar>?
getting value of command link which is in series panel