• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

method-signatur for actionListener

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

void listenMethod(ActionEvent event) is what you need.
 
Rafael Belin
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic