• 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
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

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)"
 
Bartender
Posts: 21000
128
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.
 
Montana has cold dark nights. Perfect for the heat from incandescent light. Tiny ad:
create, convert, edit or print DOC and DOCX in Java
https://products.aspose.com/words/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!