Hi Folks,
Is it possible to have multiple actionListeners on a command button?
If not is there any way around this?
Thanks for your help!
Hi Folks,
Is it possible to have multiple actionListeners on a command button?
If not is there any way around this?
Thanks for your help!
No, you can only add two server-side callback methods:
actionListener
and action
.<ice:commandButton action="#{bean.navigateTo}" actionListener="#{bean.doSomething}"/>
actionListener
has to point to a public method which returns void
and takes an ActionEvent as an argument. It is generally used for any tasks which are not related to any navigation logic and has the advantage, to provide you with the old and new (= changed) value of the control. This makes particular sense in input controls like checkboxes.
action
has to point to a public method which returns a String
without taking any arguments. The method will do everything what is needed for navigating - for example additional validation (if it hasn't been handled by some basic JSF validator). The outcome has to match the navigation rules from faces-config.xml
.
That should give you enough possibilities to handle multiple tasks (which I assume is your reason for having multiple actionListener) within your server logic.
Additionally, if you need to do only some client-side tasks, you can take advantage of several on* JavaScript properties.
Reference: ICEfaces Custom Components Taglib