JSF Showcase


The f:validateRequired Facelet tag can be used to require a value from a UIInput Component. f:validateRequired activates the same validation logic as required="true" and UIInput.setRequired(true).

General Usage

Source Code

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

		<label class="control-label">#{i18n['required']}</label>
		<h:inputText id="required" value="#{inputTextModelBean.text}"
			<f:validateRequired />
		<br />
		<h:message for="required" />
		<hr />
		<h:commandButton value="#{i18n['submit']}">
			<f:ajax	execute="@form" render="@form" />
		<h:outputText value="#{inputTextModelBean.text}" />

public class InputTextModelBean {

	private Date date = new GregorianCalendar().getTime();
	private String text;

	public Date getDate() {
		return date;

	public String getText() {
		return text;

	public void setDate(Date date) {
		this.date = date;

	public void setText(String text) {
		this.text = text;
Liferay Faces Bridge Implementation 4.0.0 + Showcase Common 3.0.0 + Liferay Faces Util 3.0.1-SNAPSHOT + Mojarra 2.2.13