Mark
Mark

Reputation: 367

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 on 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!

Upvotes: 2

Views: 2856

Answers (1)

Jose Diaz
Jose Diaz

Reputation: 5398

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.

Hope this can help.

Regards.

Upvotes: 1

Related Questions