f:validateLongRange

The f:validateLongRange Facelet tag exposes the functionality of a LongRangeValidator inside Facelet views.

Geral Usage

The minimum and maximum attributes can be used to specify the range limits for an integer value.



                   

Código fonte

<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">

	<h:form>
		<label class="control-label">#{i18n.replace('please-enter-a-value-between-x-and-x', 5, 8)}</label>
		<h:inputText id="long" value="#{validationModelBean.longNumber}"
			label="#{i18n['f-validatelongrange-label']}">
			<f:validateDoubleRange minimum="5" maximum="8" />
		</h:inputText>
		<br />
		<h:message for="long" />
		<hr />
		<h:commandButton value="#{i18n['submit']}">
			<f:ajax	execute="@form" render="@form" />
		</h:commandButton>
		<h:outputText value="#{validationModelBean.longNumber}" />
	</h:form>

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

	@Pattern(regexp = ".+[@].+[.].+")
	private String email;
	private Double doubleNumber;
	private Long longNumber;
	private String otherText;

	public Double getDoubleNumber() {
		return doubleNumber;
	}

	public String getEmail() {
		return email;
	}

	public Long getLongNumber() {
		return longNumber;
	}

	public String getOtherText() {
		return otherText;
	}

	public void setDoubleNumber(Double doubleNumber) {
		this.doubleNumber = doubleNumber;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public void setLongNumber(Long longNumber) {
		this.longNumber = longNumber;
	}

	public void setOtherText(String otherText) {
		this.otherText = otherText;
	}
}
Liferay Faces Bridge Implementation 5.0.0 + Liferay Faces Portal 5.0.0 + Showcase Common 3.1.1 + Liferay Faces Util 3.4.1 + Mojarra 2.2.20