JBoss.orgCommunity Documentation
Along with a4j:htmlCommandLink , <a4j:form> component fixes the problem of <h:commandLink> component that cannot be re-rendered without re-rendering the whole form it belongs to. For the further details see the Ajax Form Usage page at RichFaces Livedemo.
The <a4j:form> component adds extra functionality to non-Ajax action/command components: submission is performed via Ajax when "ajaxSubmit" attribute set to "true".
If the <a4j:form> component works in an Ajax mode, the standard Ajax attributes such as "reRender" , "limitToList" , "requestDelay" , etc. can be used.
Example:
...
<a4j:form ajaxSubmit="true" reRender="name">
<h:panelGrid>
<h:commandButton value="Set Local Name to John (Ajax)" action="#{userBean.nameItJohn}" />
<h:outputText id="name" value="Name:#{userBean.name}" />
</h:panelGrid>
</a4j:form>
...
Here is a managed bean:
...
public class UserBean {
private String name="";
public String nameItJohn() {
setName("John");
return null;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
}
...
In the example above the
ajaxSubmit="true"
,
so all standard action components on this form become ajaxable.
The
"reRender"
attribute contains an Id of component for
re-rendering after an Ajax response.
If you have <h:commandButton> or <h:commandLink> inside a form, they work as <a4j:commandButton> .
You should not use
<a4j:form>
component with
ajaxSubmit="true"
if it contains other Ajax command components.
Also, due to the security reason, file upload form element cannot be convertible to the be ajaxable.
Visit Ajax Form page at RichFaces Livedemo for examples of component usage and their sources.
For additional information about attributes of this component read 'Ajax Attribute section.