What is the difference between actionlistener and action?

0

What's the difference between actionListener and action ? When to use one or the other?

<h:commandButton action="xxxx" actionListener="zzzz" id="teste"/>
    
asked by anonymous 25.11.2016 / 16:55

1 answer

1

Although you can use them in the same way (perform actions), I think the best question is "when" to use one in spite of another.

Action

You should use an action if you intend to run business logic or navigate between pages . The action method can return a String indicating the navigation rule.

ActionListener

You should use an actionListener if what you want to do is execute a view-related logic or trigger an action before a business logic. The logic invoked by an actionListener is more closely linked to details of the screen than purely business rules.

Not to be in the 'spool', link

    
26.11.2016 / 14:11