开发者

JSF: How to add ajax functionality to component in backing bean?

I want to incorporate the functionality to a HtmlCommandButton. How do I go about doing that? I can't seem to find too many examples o开发者_JAVA技巧n the web. I see there is something called AjaxBehavoir, but I'm not sure how to incorporate that into my HtmlCommandButton. Essentially I want to do the following to my component:

  <f:ajax execute="@this" render="component1 component2" />

Thanks!


You should familiarize yourself with the components of the new javax.faces.component.behavior package in the JSF 2.0 API.

I don't know if it is recommended to use a programmatic approach to set up ajax behavior directly in your backing bean instead of the more common idiom:

<h:commandButton>
 <f:ajax event="onclick" execute="@this" render="component1 component2" />
</h:commandButton>

Here are a couple of links that should get you up and running with this.

  • JSF 2.0 jsf.ajax JavaScript API
  • JSF 2.0 Client Behavior (Very good introduction as to how the Ajax behavior defined in your <f:ajax> components is mapped to and from a backing bean).

Hope this can help.

Regards.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜