0
What’s the difference between actionListener and action? When using one or the other?
<h:commandButton action="xxxx" actionListener="zzzz" id="teste"/>
0
What’s the difference between actionListener and action? When using one or the other?
<h:commandButton action="xxxx" actionListener="zzzz" id="teste"/>
1
Although you can use them in the same way ( perform actions ), I think the better question is "when" to use one despite another.
Action
You should use an action if your intention is run a 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 tied to screen details than purely business rules.
Not to be in the copy-glue', http://blog.triadworks.com.br/quando-usar-action-ou-actionlistener-com-jsf
Browser other questions tagged jsf jsf-2.2
You are not signed in. Login or sign up in order to post.
In what context?
– user28595
<h:commandButton action="xxxx" actionListener="zzzz" id="teste"/>
– felipesa
Edit the question and add it directly to it so it doesn’t get vague and close.
– user28595
Answer:Differences between action and actionListener if you know English, this link has a very complete explanation of the differences between them and when to use one or the other.
– user28595
The link is pointing to the same question
– felipesa
opa, corrected.
– user28595