views:

38

answers:

1

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!

+1  A: 

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.

StudiousJoseph
Thanks for the links...I tried using the "setOnclick" method as suggested in one of the links, but still isn't working. I'll keey trying.
Steve
If you think it's going to be verbose to have the f:ajax inside every command button, you can wrap this into a composite component and us it like this...<steve:ajaxCommandButton value="Click me!" action="#{somebean.someaction}" render="component1 component2"/>
Drew