I have a simple HTMLCommandButton that I want to cause a rerender to another component. I开发者_如何学Go know of a simple way to do that - add an ajax support object and have it run on "onclick" event and rerender.
<h:commandButton value="Submit" action="#{actions.submitToDB}">
<a4j:support event="onclick" reRender="Button0" />
</h:commandButton>
I figured there has to be a smarter way to do this with the on* attributes of the HTML CommandButton but I'm not sure what to write to cause the rerender (Using this alleged method)
Thanks!
No, there isn't a smarter way in the common case. This is the way to do it. You will have to do the following
- set
type="button"
on the button. - set the action on the
<a4j:support>
rather than on the button istself.
In this particular case (a button) a shortcut will be:
<a4j:commandButton value="Submit"
action="#{actions.submitToDB}" reRender="Button0" />
精彩评论