简体   繁体   中英

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!

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM