Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

method-signatur for actionListener

 
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
 
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)"
 
Saloon Keeper
Posts: 22097
151
Android Eclipse IDE Tomcat Server Redhat Java 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.
 
Self destruct mode activated. Instructions for deactivation encoded in this tiny ad.
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic