开发者

How to call an action from input component's onchange?

Given for example a SelectOneMenu, I can trigger valueChangeListeners or rerendering of page fragments via f:ajax:

<h:selectOneMenu valueChangeListener="..." ... >
  <f:ajax render="@form" execute="@form" />
</h:selectOneMenu>

That's nice, but I want to do some more complicated stuff when the box changes (if validation is passed). Is there any possibility to call an actio开发者_运维知识库n method on a bean using f:ajax when it's not attached to a UICommand component? Or, if not, how can I call a bean method in the "invoke application" phase when the value of the select box changes?


<f:ajax> has a listener attribute. From the api docs, the listener attribute is a:

Method expression referencing a method that will be called when an AjaxBehaviorEvent has been broadcast for the listener

http://java.sun.com/javaee/javaserverfaces/2.0/docs/pdldocs/facelets/f/ajax.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜