I need use the button to call a method of a Managed Bean but it doen't have any ActionListener. I have something like this:
<b:button value="Tes1" look="warning"size="lg"/>
I can't use the commandButton. Is there any way? Thanks!
I need use the button to call a method of a Managed Bean but it doen't have any ActionListener. I have something like this:
<b:button value="Tes1" look="warning"size="lg"/>
I can't use the commandButton. Is there any way? Thanks!
In the question and the attempted solution, it was indeed approaching it from the wrong way. A b:commandButton
can be used in the following way:
<b:commandButton value="Trigger (JSF passthrough)2" actionListener="#{managedBeanName.performCall}" immediate="true" update="@(#id_element)"/>
The key of this solution are immediate=true
to scape validations and update="@(#id_element)"
to update only a part of the screen. You could also use update="@none"
to don't update the screen.
It needs to be inside a form.
Another option is to use process="@this"
instead of immediate=true
. In this way, it doesn't perform any validation since it does not submit any inputs from the form.
<b:commandButton value="Trigger (JSF passthrough)2" actionListener="#{managedBeanName.performCall}" process="@this" update="@(#id_element)"/>
Since the introduction of 'ajax' in JSF, this latter solution is more commonly used.
See also: