h:form

HtmlForm is a UIForm component that renders a <form> element.

Non-Ajax Usage

When an h:form is submitted via h:commandButton or h:commandLink it is submitted as a full-page postback by default.

Source Code

<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://xmlns.jcp.org/jsf/html"
	xmlns:ui="http://xmlns.jcp.org/jsf/facelets">

	<h:form>
		<h:messages globalOnly="true" layout="table" />
		<h:commandButton action="#{formBackingBean.submit}"
			value="#{i18n['submit-and-re-render-form']}" />
	</h:form>

</ui:composition>
@RequestScoped
@ManagedBean
public class FormBackingBean {

	public void submit() {

		FacesContext facesContext = FacesContext.getCurrentInstance();
		FacesMessage facesMessage = null;

		if (facesContext.getPartialViewContext().isAjaxRequest()) {
			facesMessage = new FacesMessage("The form was submitted via Ajax and re-rendered with updates to the DOM.");
		}
		else {
			facesMessage = new FacesMessage(
					"The form was submitted as a full page postback and the entire page was re-rendered.");
		}

		facesContext.addMessage(null, facesMessage);
	}
}
Liferay Faces Bridge Implementation 5.0.0 + Showcase Common 3.1.1 + Liferay Faces Util 3.4.1 + Mojarra 2.2.20