Portal Showcase


You can choose between SimpleCaptcha and ReCaptcha implementations by modifying the value of the captcha.engine.impl property in your portal-ext.properties file.

For more information, see the default values in the "Captcha" section of Liferay Portal's portal.properties file.


Captcha is a UIInput that renders Liferay Portal's captcha image and a field for editing single-line text. It provides built-in validation in order to make sure that the text value entered by the user matches the value in the captcha image.

General Usage

The value attribute can be bound to a model bean property via EL.

Source Code

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

		<h:messages layout="table" />
		<portal:captcha required="true" value="#{captchaBacking.captchaText}" />
		<h:commandButton action="#{captchaBacking.submit}" value="#{i18n['submit']}">
			<f:ajax execute="@form" render="@form :modelValue" />
	<h:outputText id="modelValue" value="#{captchaBacking.captchaText}" />

public class CaptchaBacking {

	private String captchaText;

	public String getCaptchaImpl() {
		return CaptchaUtil.getCaptcha().getClass().getName();

	public String getCaptchaText() {
		return captchaText;

	public void setCaptchaText(String captchaText) {
		this.captchaText = captchaText;

	public void submit() {

		FacesContext facesContext = FacesContext.getCurrentInstance();
		FacesMessage facesMessage = new FacesMessage("You entered the correct text verification code.");
		facesContext.addMessage(null, facesMessage);
Liferay Faces Bridge Implementation 4.0.0 + Liferay Faces Portal 3.0.0 + Showcase Common 3.0.0 + Liferay Faces Util 3.0.0 + Mojarra 2.2.13