问题描述
我有一个<a4j:commandLink>
,我需要在控制器上触发一个动作,
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>
当我单击链接时,onbegin javascript已成功触发,但从未调用该操作.这是我从控制器执行的操作:
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) {
...
}
}
我的viewBean是视图作用域的,guid来自组件...我在这里缺少什么?
My viewBean is view scoped and the guid comes from the component... What am I missing here?
编辑
如果我将链接更改为按钮,则可以使用...但是我需要一个链接:
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>
推荐答案
根据文档:
"MethodExpression表示将在用户激活此组件时通知的动作侦听器方法.该表达式必须计算为采用ActionEvent参数且返回类型为void的公共方法."
"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
(签名必须与void actionListener(javax.faces.event.ActionEvent
)匹配)
javax.el.MethodExpression
(signature must match void actionListener(javax.faces.event.ActionEvent
))
这篇关于< a4j:commandLink>动作未触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!