• Post Reply Bookmark Topic Watch Topic
  • New Topic

method-signatur for actionListener  RSS feed

 
Rafael Belin
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I have one question about the method-signature for an actionListener in the composite component. The code below doesnt work, because the method-signatur works only for methods. Would you be so nice and could you help me to define the method-signature correctly? My actionListener is implemented as a method in the ManagedBean. (Of course there is a possibility to make it with the actionSource, but than it is necessery to implement the actionListener as a class).




actionListener as a method in a ManagedBean
 
Brendan Healey
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

void listenMethod(ActionEvent event) is what you need.
 
Rafael Belin
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your answer Brendan, I have tried to do that, but unfortunately it doesnt work. The exception is javax.el.PropertyNotFoundException. (If I replace the actionListener with the action and I call the method wothout any arguments, it works). Have you any other idees, how to do it with the actionListener?

Thanks for you replies!!!
 
Brendan Healey
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you need to use this syntax actionListener="#{cc.attrs[myListener]}". I know it looks all wrong,
but....
 
Rafael Belin
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have found solution. We have to change the method-signature in the interface of our composite components. On the other hand the method, in the ManagedBean, must have an ActionEvent as an argument.





PS: method-signature can also looks like this: method-signature="void f(javax.faces.event.ActionEvent)"
 
Tim Holloway
Bartender
Posts: 18663
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Still, I'm going to be a party-pooper and repeat (again) that since 2006 when I first started using JSF in production, I've never used an ActionListener in any of my webapps.

It's not that ActionListeners are totally useless, but the particular cases where it's preferable to use an ActionListener instead of the simpler more portable action method are so specialized and so rare that I've never done so.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!