问题
I have an <a4j:commandLink>
which I need to fire an action on my controller,
<h:form>
<a4j:commandLink
actionListener="#{controller.send(viewBean.id, cc.attrs.guid)}"
onbegin="$.efc.busy($.messages.sending);"
oncomplete="$.efc.busy('', true);">
Send offer to this dealer
</a4j:commandLink>
</h:form>
When I click on the link, the onbegin javascript is successfully fired but the action is never called. Here is my action from my controller:
public void send(String id, String guid) {
if (id != null && guid != null) {
...
}
}
My viewBean is view scoped and the guid comes from the component... What am I missing here?
EDIT
If I change the link to a button it works... but I need a link:
<a4j:commandButton
action="#{controller.send(viewBean.id, cc.attrs.guid)}"
onbegin="$.efc.busy($.messages.sending);"
oncomplete="$.efc.busy('', true);"
value="Send offer to this dealer">
</a4j:commandButton>
回答1:
According to documentation :
"MethodExpression representing an action listener method that will be notified when this component is activated by the user. The expression must evaluate to a public method that takes an ActionEvent parameter, with a return type of void."
javax.el.MethodExpression
(signature must match void actionListener(javax.faces.event.ActionEvent
))
来源:https://stackoverflow.com/questions/22413820/a4jcommandlink-action-not-fired